Skip to content

25 december #75

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .learn/resets/001-hello_world/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Your code here
8 changes: 8 additions & 0 deletions .learn/resets/002-sum_of_three_numbers/app.py
Original file line number Diff line number Diff line change
@@ -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)
7 changes: 7 additions & 0 deletions .learn/resets/003-area_of_right_triangle/app.py
Original file line number Diff line number Diff line change
@@ -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))
7 changes: 7 additions & 0 deletions .learn/resets/004-hello_harry/app.py
Original file line number Diff line number Diff line change
@@ -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"))
8 changes: 8 additions & 0 deletions .learn/resets/005-previous_and_next/app.py
Original file line number Diff line number Diff line change
@@ -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))
6 changes: 6 additions & 0 deletions .learn/resets/006-apple_sharing/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
def apple_sharing(n,k):
# Your code here
return None


print(apple_sharing(6,50))
5 changes: 5 additions & 0 deletions .learn/resets/006.1-square_value_of_number/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def square(num):
# Your code here
return None

print(square(6))
6 changes: 6 additions & 0 deletions .learn/resets/007-hours_and_minutes/app.py
Original file line number Diff line number Diff line change
@@ -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))
7 changes: 7 additions & 0 deletions .learn/resets/008-two_timestamps/app.py
Original file line number Diff line number Diff line change
@@ -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))
8 changes: 8 additions & 0 deletions .learn/resets/009-two_digits/app.py
Original file line number Diff line number Diff line change
@@ -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))
7 changes: 7 additions & 0 deletions .learn/resets/010-swap_digits/app.py
Original file line number Diff line number Diff line change
@@ -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))
6 changes: 6 additions & 0 deletions .learn/resets/011-last_two_digits/app.py
Original file line number Diff line number Diff line change
@@ -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())
7 changes: 7 additions & 0 deletions .learn/resets/012-tens_digit/app.py
Original file line number Diff line number Diff line change
@@ -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())
7 changes: 7 additions & 0 deletions .learn/resets/013-sum_of_digits/app.py
Original file line number Diff line number Diff line change
@@ -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))
7 changes: 7 additions & 0 deletions .learn/resets/014-digit_after_decimal_point/app.py
Original file line number Diff line number Diff line change
@@ -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())
7 changes: 7 additions & 0 deletions .learn/resets/015-car_route/app.py
Original file line number Diff line number Diff line change
@@ -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())
7 changes: 7 additions & 0 deletions .learn/resets/016-century/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Complete the function to return the respective number of the century
def century(year):
return None


# Invoke the function with any given year
print(century())
7 changes: 7 additions & 0 deletions .learn/resets/017-total_cost/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Complete the function to return the total cost in dollars and cents of (n) cupcakes
def total_cost(d, c, n):
return None


# Invoke the function with three integers: total_cost(dollars, cents, number_of_cupcakes)
print(total_cost(15,22,4))
7 changes: 7 additions & 0 deletions .learn/resets/018-day_of_week/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Complete the function to return the number of day of the week for k'th day of year
def day_of_week(k):
return None


# Invoke function day_of_week with an integer between 1 and 365
print(day_of_week())
6 changes: 6 additions & 0 deletions .learn/resets/019-digital_clock/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Complete the function to return how many hours and minutes are displayed on the 24h digital clock
def digital_clock(n):
return None

# Invoke the function with any integer (minutes after midnight)
print(digital_clock())
1 change: 1 addition & 0 deletions .learn/resets/020-factorial/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Your code here
1 change: 1 addition & 0 deletions .learn/resets/021-square_root/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Your code here
1 change: 1 addition & 0 deletions .learn/resets/022-Integral/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Your code here
1 change: 1 addition & 0 deletions .learn/resets/023-list-and-tuple/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Your code here
1 change: 1 addition & 0 deletions .learn/resets/024-class-with-two-methods/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Your code here
1 change: 1 addition & 0 deletions exercises/001-hello_world/app.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# Your code here
print("Hello World")
2 changes: 1 addition & 1 deletion exercises/002-sum_of_three_numbers/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@


# Print here the sum of all three inputs
print(first_number+second_number)
print(first_number+second_number+third_number)
2 changes: 1 addition & 1 deletion exercises/003-area_of_right_triangle/app.py
Original file line number Diff line number Diff line change
@@ -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))
2 changes: 1 addition & 1 deletion exercises/004-hello_harry/app.py
Original file line number Diff line number Diff line change
@@ -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"))
2 changes: 1 addition & 1 deletion exercises/005-previous_and_next/app.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion exercises/006-apple_sharing/app.py
Original file line number Diff line number Diff line change
@@ -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))
2 changes: 1 addition & 1 deletion exercises/006.1-square_value_of_number/app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
def square(num):
# Your code here
return None
return num**2

print(square(6))
2 changes: 1 addition & 1 deletion exercises/007-hours_and_minutes/app.py
Original file line number Diff line number Diff line change
@@ -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))
2 changes: 1 addition & 1 deletion exercises/008-two_timestamps/app.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion exercises/009-two_digits/app.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion exercises/010-swap_digits/app.py
Original file line number Diff line number Diff line change
@@ -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))
4 changes: 2 additions & 2 deletions exercises/011-last_two_digits/app.py
Original file line number Diff line number Diff line change
@@ -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))
4 changes: 2 additions & 2 deletions exercises/012-tens_digit/app.py
Original file line number Diff line number Diff line change
@@ -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))
2 changes: 1 addition & 1 deletion exercises/013-sum_of_digits/app.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 3 additions & 2 deletions exercises/014-digit_after_decimal_point/app.py
Original file line number Diff line number Diff line change
@@ -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))
6 changes: 4 additions & 2 deletions exercises/015-car_route/app.py
Original file line number Diff line number Diff line change
@@ -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))
9 changes: 7 additions & 2 deletions exercises/016-century/app.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# Complete the function to return the respective number of the century
import math

def century(year):
return None
if year % 100 == 0:
return math.floor(year/100)
else:
return math.floor((year/100))+1


# Invoke the function with any given year
print(century())
print(century(2024))
9 changes: 8 additions & 1 deletion exercises/017-total_cost/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Complete the function to return the total cost in dollars and cents of (n) cupcakes
import math

def total_cost(d, c, n):
return None
dollars = n*d
cents = n*c
if cents >= 100:
dollars += math.floor(cents/100)
cents = cents%100
return (dollars, cents)


# Invoke the function with three integers: total_cost(dollars, cents, number_of_cupcakes)
Expand Down
6 changes: 4 additions & 2 deletions exercises/018-day_of_week/app.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Complete the function to return the number of day of the week for k'th day of year
def day_of_week(k):
return None
day=(3+k)%7
return day



# Invoke function day_of_week with an integer between 1 and 365
print(day_of_week())
print(day_of_week(4))
6 changes: 4 additions & 2 deletions exercises/019-digital_clock/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Complete the function to return how many hours and minutes are displayed on the 24h digital clock
import math

def digital_clock(n):
return None
return (math.floor(n/60), n%60)

# Invoke the function with any integer (minutes after midnight)
print(digital_clock())
print(digital_clock(1439))
6 changes: 6 additions & 0 deletions exercises/020-factorial/app.py
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
# Your code here
def factorial (n):
result = 1
for i in range(1, n + 1):
result *= i
return result
print(factorial(8))
6 changes: 6 additions & 0 deletions exercises/021-square_root/app.py
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
# Your code here
import math

def square_root(n):
return round(math.sqrt(n), 2)

print(square_root(7))
7 changes: 7 additions & 0 deletions exercises/022-Integral/app.py
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
# Your code here
def squares_dictionary(n):
sqr_dict = {}
for i in range(1, n+1):
sqr_dict[i]=i*i
return sqr_dict

print(squares_dictionary(8))
7 changes: 7 additions & 0 deletions exercises/023-list-and-tuple/app.py
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
# Your code here
def list_and_tuple(*arg):
args=[]
for i in arg:
args.append(str(i))
return (list(args), tuple(args))

print(list_and_tuple(34,67,55,33,12,98))
Loading