Skip to content

Commit 9dca5a6

Browse files
committed
Added till 24
1 parent 7176d16 commit 9dca5a6

File tree

17 files changed

+81
-7
lines changed

17 files changed

+81
-7
lines changed

.learn/resets/016-century/app.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Complete the function to return the respective number of the century
2+
def century(year):
3+
return None
4+
5+
6+
# Invoke the function with any given year
7+
print(century())

.learn/resets/017-total_cost/app.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Complete the function to return the total cost in dollars and cents of (n) cupcakes
2+
def total_cost(d, c, n):
3+
return None
4+
5+
6+
# Invoke the function with three integers: total_cost(dollars, cents, number_of_cupcakes)
7+
print(total_cost(15,22,4))

.learn/resets/018-day_of_week/app.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Complete the function to return the number of day of the week for k'th day of year
2+
def day_of_week(k):
3+
return None
4+
5+
6+
# Invoke function day_of_week with an integer between 1 and 365
7+
print(day_of_week())
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Complete the function to return how many hours and minutes are displayed on the 24h digital clock
2+
def digital_clock(n):
3+
return None
4+
5+
# Invoke the function with any integer (minutes after midnight)
6+
print(digital_clock())

.learn/resets/020-factorial/app.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Your code here

.learn/resets/021-square_root/app.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Your code here

.learn/resets/022-Integral/app.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Your code here
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Your code here
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Your code here

exercises/016-century/app.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
# Complete the function to return the respective number of the century
2+
import math
3+
24
def century(year):
3-
return None
5+
if year % 100 == 0:
6+
return math.floor(year/100)
7+
else:
8+
return math.floor((year/100))+1
49

510

611
# Invoke the function with any given year
7-
print(century())
12+
print(century(2024))

exercises/017-total_cost/app.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
# Complete the function to return the total cost in dollars and cents of (n) cupcakes
2+
import math
3+
24
def total_cost(d, c, n):
3-
return None
5+
dollars = n*d
6+
cents = n*c
7+
if cents >= 100:
8+
dollars += math.floor(cents/100)
9+
cents = cents%100
10+
return (dollars, cents)
411

512

613
# Invoke the function with three integers: total_cost(dollars, cents, number_of_cupcakes)

exercises/018-day_of_week/app.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Complete the function to return the number of day of the week for k'th day of year
22
def day_of_week(k):
3-
return None
3+
day=(3+k)%7
4+
return day
5+
46

57

68
# Invoke function day_of_week with an integer between 1 and 365
7-
print(day_of_week())
9+
print(day_of_week(4))

exercises/019-digital_clock/app.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Complete the function to return how many hours and minutes are displayed on the 24h digital clock
2+
import math
3+
24
def digital_clock(n):
3-
return None
5+
return (math.floor(n/60), n%60)
46

57
# Invoke the function with any integer (minutes after midnight)
6-
print(digital_clock())
8+
print(digital_clock(1439))

exercises/020-factorial/app.py

+6
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
11
# Your code here
2+
def factorial (n):
3+
result = 1
4+
for i in range(1, n + 1):
5+
result *= i
6+
return result
7+
print(factorial(8))

exercises/021-square_root/app.py

+6
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
11
# Your code here
2+
import math
3+
4+
def square_root(n):
5+
return round(math.sqrt(n), 2)
6+
7+
print(square_root(7))

exercises/022-Integral/app.py

+7
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
11
# Your code here
2+
def squares_dictionary(n):
3+
sqr_dict = {}
4+
for i in range(1, n+1):
5+
sqr_dict[i]=i*i
6+
return sqr_dict
7+
8+
print(squares_dictionary(8))

exercises/023-list-and-tuple/app.py

+7
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
11
# Your code here
2+
def list_and_tuple(*arg):
3+
args=[]
4+
for i in arg:
5+
args.append(str(i))
6+
return (list(args), tuple(args))
7+
8+
print(list_and_tuple(34,67,55,33,12,98))

0 commit comments

Comments
 (0)