File tree

7 files changed

+33
-15
lines changed

7 files changed

+33
-15
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#Complete the function to return the first digit to the right of the decimal point.
22
def first_digit(num):
3-
return None
3+
return (((num%100)*100)%100)//10
44

55

66

77
#Invoke the function with a positive real number. ex. 34.33
8-
print(first_digit())
8+
print(first_digit(1.79))
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#Complete the function to return the amount of days it will take to cover a route.
22
#HINT: You may need to import the math module for this exercise.
3+
import math
34

45
def car_route(n,m):
5-
return None
6+
return math.ceil(m/n)
67

78

89
#Invoke the function with two intergers.
9-
print(car_route())
10+
print(car_route(700, 750))
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#Complete the function to return the respective number of the century
22
#HINT: You may need to import the math module.
3+
import math
34

45
def century(year):
5-
return None
6+
return year//100 + 1
67

78

89

910
#Invoke the function with any given year.
10-
print(century())
11+
print(century(1993))
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#Complete the function to return the total cost in dollars and cents of N cupcakes.
22
#Remember you can return multiple parameters => return a, b
33
def total_cost(d,c,n):
4-
return None
4+
return d*n, c*n
55

66

77

88

99
#Invoke the function with three intergers: cost(dollars and cents) & number of cupcakes.
10-
print(total_cost())
10+
print(total_cost(20, 30, 5))
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
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-
4-
return None
5-
3+
if (k == 1):
4+
return 4
5+
if (k == 2):
6+
return 5
7+
if (k == 3):
8+
return 6
9+
if (k == 4):
10+
return 7
11+
if (k == 5):
12+
return 1
13+
if (k == 6):
14+
return 2
15+
else:
16+
return 3
617

718

819
#Invoke function day_of_week with an interger between 0 and 6 (number for days of week)
9-
print(day_of_week())
20+
print(day_of_week(1))
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Complete the function to return how many hrs and min are displayed on the 24th digital clock.
22
def digital_clock(n):
3-
return None
3+
return n//60, n%60
44

55
#Invoke the function with any interger (seconds after midnight)
6-
print(digital_clock())
6+
print(digital_clock(150))
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
# Your code here
1+
# Your code here
2+
x = int(input("coloca el numero para buscar su factorial"))
3+
fac = 1
4+
for i in range(x, 0, -1):
5+
fac=fac*i
6+
print(fac)

0 commit comments

Comments
 (0)