From fca47063c25f2d95d72069b733afade4d7b16403 Mon Sep 17 00:00:00 2001 From: Daniel Anderi <100786824+danderi@users.noreply.github.com> Date: Tue, 10 Dec 2024 23:08:14 +0000 Subject: [PATCH 1/5] primer commit --- .learn/resets/001-hello_world/app.py | 1 + exercises/001-hello_world/app.py | 1 + 2 files changed, 2 insertions(+) create mode 100644 .learn/resets/001-hello_world/app.py diff --git a/.learn/resets/001-hello_world/app.py b/.learn/resets/001-hello_world/app.py new file mode 100644 index 00000000..fce62c1d --- /dev/null +++ b/.learn/resets/001-hello_world/app.py @@ -0,0 +1 @@ +# Your code here diff --git a/exercises/001-hello_world/app.py b/exercises/001-hello_world/app.py index fce62c1d..a9b76882 100644 --- a/exercises/001-hello_world/app.py +++ b/exercises/001-hello_world/app.py @@ -1 +1,2 @@ # Your code here +print("Hello World") \ No newline at end of file From 1882f4797836d4f2efec702aeb65e7deaafac6c2 Mon Sep 17 00:00:00 2001 From: Daniel Anderi <100786824+danderi@users.noreply.github.com> Date: Tue, 10 Dec 2024 23:47:07 +0000 Subject: [PATCH 2/5] 5 done out of 45 --- .learn/resets/002-sum_of_three_numbers/app.py | 8 ++++++++ .learn/resets/003-area_of_right_triangle/app.py | 7 +++++++ .learn/resets/004-hello_harry/app.py | 7 +++++++ .learn/resets/005-previous_and_next/app.py | 8 ++++++++ .learn/resets/006-apple_sharing/app.py | 6 ++++++ exercises/002-sum_of_three_numbers/app.py | 2 +- exercises/003-area_of_right_triangle/app.py | 2 +- exercises/004-hello_harry/app.py | 2 +- exercises/005-previous_and_next/app.py | 2 +- 9 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 .learn/resets/002-sum_of_three_numbers/app.py create mode 100644 .learn/resets/003-area_of_right_triangle/app.py create mode 100644 .learn/resets/004-hello_harry/app.py create mode 100644 .learn/resets/005-previous_and_next/app.py create mode 100644 .learn/resets/006-apple_sharing/app.py diff --git a/.learn/resets/002-sum_of_three_numbers/app.py b/.learn/resets/002-sum_of_three_numbers/app.py new file mode 100644 index 00000000..21d0f403 --- /dev/null +++ b/.learn/resets/002-sum_of_three_numbers/app.py @@ -0,0 +1,8 @@ +# Sum all three input numbers and print on the console the result +first_number = int(input("First input: ")) +second_number = int(input("Second input: ")) +third_number = int(input("Third input: ")) + + +# Print here the sum of all three inputs +print(first_number+second_number) diff --git a/.learn/resets/003-area_of_right_triangle/app.py b/.learn/resets/003-area_of_right_triangle/app.py new file mode 100644 index 00000000..6b4bb318 --- /dev/null +++ b/.learn/resets/003-area_of_right_triangle/app.py @@ -0,0 +1,7 @@ +# Complete the function to return the area of a triangle +def area_of_triangle(base, height): + # Your code here, please remove the "None" + return None + +# Testing your function +print(area_of_triangle(3, 5)) diff --git a/.learn/resets/004-hello_harry/app.py b/.learn/resets/004-hello_harry/app.py new file mode 100644 index 00000000..4d3f3e24 --- /dev/null +++ b/.learn/resets/004-hello_harry/app.py @@ -0,0 +1,7 @@ +# Complete the function below to print the output as per the example +def hello_name(name): + # Your code here + return None + +# Invoke the function with your name as the function's argument +print(hello_name("Bob")) diff --git a/.learn/resets/005-previous_and_next/app.py b/.learn/resets/005-previous_and_next/app.py new file mode 100644 index 00000000..d549fb0d --- /dev/null +++ b/.learn/resets/005-previous_and_next/app.py @@ -0,0 +1,8 @@ +# Complete the function to return the previous and next number of a given number +def previous_next(num): + # Your code here + return None + + +# Invoke the function with any integer as its argument +print(previous_next(179)) diff --git a/.learn/resets/006-apple_sharing/app.py b/.learn/resets/006-apple_sharing/app.py new file mode 100644 index 00000000..2c17d877 --- /dev/null +++ b/.learn/resets/006-apple_sharing/app.py @@ -0,0 +1,6 @@ +def apple_sharing(n,k): + # Your code here + return None + + +print(apple_sharing(6,50)) diff --git a/exercises/002-sum_of_three_numbers/app.py b/exercises/002-sum_of_three_numbers/app.py index 21d0f403..ba0bd5fa 100644 --- a/exercises/002-sum_of_three_numbers/app.py +++ b/exercises/002-sum_of_three_numbers/app.py @@ -5,4 +5,4 @@ # Print here the sum of all three inputs -print(first_number+second_number) +print(first_number+second_number+third_number) diff --git a/exercises/003-area_of_right_triangle/app.py b/exercises/003-area_of_right_triangle/app.py index 6b4bb318..6ac0c57b 100644 --- a/exercises/003-area_of_right_triangle/app.py +++ b/exercises/003-area_of_right_triangle/app.py @@ -1,7 +1,7 @@ # Complete the function to return the area of a triangle def area_of_triangle(base, height): # Your code here, please remove the "None" - return None + return base * height / 2 # Testing your function print(area_of_triangle(3, 5)) diff --git a/exercises/004-hello_harry/app.py b/exercises/004-hello_harry/app.py index 4d3f3e24..20294c80 100644 --- a/exercises/004-hello_harry/app.py +++ b/exercises/004-hello_harry/app.py @@ -1,7 +1,7 @@ # Complete the function below to print the output as per the example def hello_name(name): # Your code here - return None + return f"Hello, {name}!" # Invoke the function with your name as the function's argument print(hello_name("Bob")) diff --git a/exercises/005-previous_and_next/app.py b/exercises/005-previous_and_next/app.py index d549fb0d..f38fad1b 100644 --- a/exercises/005-previous_and_next/app.py +++ b/exercises/005-previous_and_next/app.py @@ -1,7 +1,7 @@ # Complete the function to return the previous and next number of a given number def previous_next(num): # Your code here - return None + return (num-1, num+1) # Invoke the function with any integer as its argument From b0d489364f2ce9ed67c2b46d8ad3079938ba9bc6 Mon Sep 17 00:00:00 2001 From: Daniel Anderi <100786824+danderi@users.noreply.github.com> Date: Tue, 10 Dec 2024 23:59:43 +0000 Subject: [PATCH 3/5] 4 out of 45 done --- exercises/006-apple_sharing/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/006-apple_sharing/app.py b/exercises/006-apple_sharing/app.py index 2c17d877..b8efcf7b 100644 --- a/exercises/006-apple_sharing/app.py +++ b/exercises/006-apple_sharing/app.py @@ -1,6 +1,6 @@ def apple_sharing(n,k): # Your code here - return None + return (int(k/n), k%n) print(apple_sharing(6,50)) From 21347aff51b41964407ca3e08c8e92bea302a5ad Mon Sep 17 00:00:00 2001 From: Daniel Anderi <100786824+danderi@users.noreply.github.com> Date: Wed, 11 Dec 2024 00:39:24 +0000 Subject: [PATCH 4/5] 7 out of 45 done --- .learn/resets/006.1-square_value_of_number/app.py | 5 +++++ .learn/resets/007-hours_and_minutes/app.py | 6 ++++++ exercises/006.1-square_value_of_number/app.py | 2 +- exercises/007-hours_and_minutes/app.py | 2 +- 4 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 .learn/resets/006.1-square_value_of_number/app.py create mode 100644 .learn/resets/007-hours_and_minutes/app.py diff --git a/.learn/resets/006.1-square_value_of_number/app.py b/.learn/resets/006.1-square_value_of_number/app.py new file mode 100644 index 00000000..086d1e41 --- /dev/null +++ b/.learn/resets/006.1-square_value_of_number/app.py @@ -0,0 +1,5 @@ +def square(num): + # Your code here + return None + +print(square(6)) diff --git a/.learn/resets/007-hours_and_minutes/app.py b/.learn/resets/007-hours_and_minutes/app.py new file mode 100644 index 00000000..14ce499b --- /dev/null +++ b/.learn/resets/007-hours_and_minutes/app.py @@ -0,0 +1,6 @@ +def hours_minutes(seconds): + # Your code here + return None + +# Invoke the function and pass any integer as its argument +print(hours_minutes(3900)) diff --git a/exercises/006.1-square_value_of_number/app.py b/exercises/006.1-square_value_of_number/app.py index 086d1e41..8e9ec110 100644 --- a/exercises/006.1-square_value_of_number/app.py +++ b/exercises/006.1-square_value_of_number/app.py @@ -1,5 +1,5 @@ def square(num): # Your code here - return None + return num**2 print(square(6)) diff --git a/exercises/007-hours_and_minutes/app.py b/exercises/007-hours_and_minutes/app.py index 14ce499b..792ed7b3 100644 --- a/exercises/007-hours_and_minutes/app.py +++ b/exercises/007-hours_and_minutes/app.py @@ -1,6 +1,6 @@ def hours_minutes(seconds): # Your code here - return None + return (int(seconds/3600), int((seconds%3600)/60)) # Invoke the function and pass any integer as its argument print(hours_minutes(3900)) From 7176d162a785fb1a543ee3ec83d3a073f8e678ac Mon Sep 17 00:00:00 2001 From: Daniel Anderi <100786824+danderi@users.noreply.github.com> Date: Sat, 14 Dec 2024 23:50:37 +0000 Subject: [PATCH 5/5] Done until excercise 15 --- .learn/resets/008-two_timestamps/app.py | 7 +++++++ .learn/resets/009-two_digits/app.py | 8 ++++++++ .learn/resets/010-swap_digits/app.py | 7 +++++++ .learn/resets/011-last_two_digits/app.py | 6 ++++++ .learn/resets/012-tens_digit/app.py | 7 +++++++ .learn/resets/013-sum_of_digits/app.py | 7 +++++++ .learn/resets/014-digit_after_decimal_point/app.py | 7 +++++++ .learn/resets/015-car_route/app.py | 7 +++++++ exercises/008-two_timestamps/app.py | 2 +- exercises/009-two_digits/app.py | 2 +- exercises/010-swap_digits/app.py | 2 +- exercises/011-last_two_digits/app.py | 4 ++-- exercises/012-tens_digit/app.py | 4 ++-- exercises/013-sum_of_digits/app.py | 2 +- exercises/014-digit_after_decimal_point/app.py | 5 +++-- exercises/015-car_route/app.py | 6 ++++-- 16 files changed, 71 insertions(+), 12 deletions(-) create mode 100644 .learn/resets/008-two_timestamps/app.py create mode 100644 .learn/resets/009-two_digits/app.py create mode 100644 .learn/resets/010-swap_digits/app.py create mode 100644 .learn/resets/011-last_two_digits/app.py create mode 100644 .learn/resets/012-tens_digit/app.py create mode 100644 .learn/resets/013-sum_of_digits/app.py create mode 100644 .learn/resets/014-digit_after_decimal_point/app.py create mode 100644 .learn/resets/015-car_route/app.py diff --git a/.learn/resets/008-two_timestamps/app.py b/.learn/resets/008-two_timestamps/app.py new file mode 100644 index 00000000..ab47d89d --- /dev/null +++ b/.learn/resets/008-two_timestamps/app.py @@ -0,0 +1,7 @@ +def two_timestamp(hr1, min1, sec1, hr2, min2, sec2): + # Your code here + return None + + +# Invoke the function and pass two timestamps(6 intergers) as its arguments +print(two_timestamp(1,1,1,2,2,2)) diff --git a/.learn/resets/009-two_digits/app.py b/.learn/resets/009-two_digits/app.py new file mode 100644 index 00000000..a8a424e7 --- /dev/null +++ b/.learn/resets/009-two_digits/app.py @@ -0,0 +1,8 @@ +# Complete the function to return the tens digit and the units digit of any interger +def two_digits(number): + # Your code here + return None + + +# Invoke the function with any two digit integer as its argument +print(two_digits(79)) diff --git a/.learn/resets/010-swap_digits/app.py b/.learn/resets/010-swap_digits/app.py new file mode 100644 index 00000000..9fc7ba9a --- /dev/null +++ b/.learn/resets/010-swap_digits/app.py @@ -0,0 +1,7 @@ +# Complete the function to return the swapped digits of a given two-digit integer +def swap_digits(num): + # Your code here + return None + +# Invoke the function with any two-digit integer as its argument +print(swap_digits(30)) diff --git a/.learn/resets/011-last_two_digits/app.py b/.learn/resets/011-last_two_digits/app.py new file mode 100644 index 00000000..cf00ec28 --- /dev/null +++ b/.learn/resets/011-last_two_digits/app.py @@ -0,0 +1,6 @@ +# Complete the function to print the last two digits of an integer greater than 9 +def last_two_digits(num): + return None + +# Invoke the function with any integer greater than 9 +print(last_two_digits()) diff --git a/.learn/resets/012-tens_digit/app.py b/.learn/resets/012-tens_digit/app.py new file mode 100644 index 00000000..467c2902 --- /dev/null +++ b/.learn/resets/012-tens_digit/app.py @@ -0,0 +1,7 @@ +# Complete the function to return the tens digit of a given integer +def tens_digit(num): + return None + + +# Invoke the function with any integer +print(tens_digit()) diff --git a/.learn/resets/013-sum_of_digits/app.py b/.learn/resets/013-sum_of_digits/app.py new file mode 100644 index 00000000..502dff35 --- /dev/null +++ b/.learn/resets/013-sum_of_digits/app.py @@ -0,0 +1,7 @@ +# Complete the function "digits_sum" so that it prints the sum of a three-digit number +def digits_sum(num): + return None + + +# Invoke the function with any three-digit number +print(digits_sum(123)) diff --git a/.learn/resets/014-digit_after_decimal_point/app.py b/.learn/resets/014-digit_after_decimal_point/app.py new file mode 100644 index 00000000..01940696 --- /dev/null +++ b/.learn/resets/014-digit_after_decimal_point/app.py @@ -0,0 +1,7 @@ +# Complete the function to return the first digit to the right of the decimal point +def first_digit(num): + return None + + +# Invoke the function with a positive real number. ex. 34.33 +print(first_digit()) diff --git a/.learn/resets/015-car_route/app.py b/.learn/resets/015-car_route/app.py new file mode 100644 index 00000000..909df947 --- /dev/null +++ b/.learn/resets/015-car_route/app.py @@ -0,0 +1,7 @@ +# Complete the function to return the amount of days it will take to cover a route +def car_route(n,m): + return None + + +# Invoke the function with two integers +print(car_route()) diff --git a/exercises/008-two_timestamps/app.py b/exercises/008-two_timestamps/app.py index ab47d89d..048bf33f 100644 --- a/exercises/008-two_timestamps/app.py +++ b/exercises/008-two_timestamps/app.py @@ -1,6 +1,6 @@ def two_timestamp(hr1, min1, sec1, hr2, min2, sec2): # Your code here - return None + return (hr2*3600)+(min2*60)+sec2 - (hr1*3600)-(min1*60)-sec1 # Invoke the function and pass two timestamps(6 intergers) as its arguments diff --git a/exercises/009-two_digits/app.py b/exercises/009-two_digits/app.py index a8a424e7..6e17c424 100644 --- a/exercises/009-two_digits/app.py +++ b/exercises/009-two_digits/app.py @@ -1,7 +1,7 @@ # Complete the function to return the tens digit and the units digit of any interger def two_digits(number): # Your code here - return None + return (number//10, number%10) # Invoke the function with any two digit integer as its argument diff --git a/exercises/010-swap_digits/app.py b/exercises/010-swap_digits/app.py index 9fc7ba9a..770feea1 100644 --- a/exercises/010-swap_digits/app.py +++ b/exercises/010-swap_digits/app.py @@ -1,7 +1,7 @@ # Complete the function to return the swapped digits of a given two-digit integer def swap_digits(num): # Your code here - return None + return int(str(num%10)+str(num//10)) # Invoke the function with any two-digit integer as its argument print(swap_digits(30)) diff --git a/exercises/011-last_two_digits/app.py b/exercises/011-last_two_digits/app.py index cf00ec28..87200b89 100644 --- a/exercises/011-last_two_digits/app.py +++ b/exercises/011-last_two_digits/app.py @@ -1,6 +1,6 @@ # Complete the function to print the last two digits of an integer greater than 9 def last_two_digits(num): - return None + return int(str(num)[-2]+str(num)[-1]) # Invoke the function with any integer greater than 9 -print(last_two_digits()) +print(last_two_digits(8825)) diff --git a/exercises/012-tens_digit/app.py b/exercises/012-tens_digit/app.py index 467c2902..4231e816 100644 --- a/exercises/012-tens_digit/app.py +++ b/exercises/012-tens_digit/app.py @@ -1,7 +1,7 @@ # Complete the function to return the tens digit of a given integer def tens_digit(num): - return None + return int(str(num)[-2]) # Invoke the function with any integer -print(tens_digit()) +print(tens_digit(179)) diff --git a/exercises/013-sum_of_digits/app.py b/exercises/013-sum_of_digits/app.py index 502dff35..931f7fe2 100644 --- a/exercises/013-sum_of_digits/app.py +++ b/exercises/013-sum_of_digits/app.py @@ -1,6 +1,6 @@ # Complete the function "digits_sum" so that it prints the sum of a three-digit number def digits_sum(num): - return None + return (num//100)+((num//10)%10)+(num%10) # Invoke the function with any three-digit number diff --git a/exercises/014-digit_after_decimal_point/app.py b/exercises/014-digit_after_decimal_point/app.py index 01940696..5adc5a27 100644 --- a/exercises/014-digit_after_decimal_point/app.py +++ b/exercises/014-digit_after_decimal_point/app.py @@ -1,7 +1,8 @@ # Complete the function to return the first digit to the right of the decimal point +import math def first_digit(num): - return None + return int(str(num).split(".")[1][0]) # Invoke the function with a positive real number. ex. 34.33 -print(first_digit()) +print(first_digit(1.79)) diff --git a/exercises/015-car_route/app.py b/exercises/015-car_route/app.py index 909df947..304b61ce 100644 --- a/exercises/015-car_route/app.py +++ b/exercises/015-car_route/app.py @@ -1,7 +1,9 @@ # Complete the function to return the amount of days it will take to cover a route +import math + def car_route(n,m): - return None + return math.floor(m/n) # Invoke the function with two integers -print(car_route()) +print(car_route(35,50))