-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpythonchallegeadvanceflow.py
More file actions
88 lines (71 loc) · 1.93 KB
/
Copy pathpythonchallegeadvanceflow.py
File metadata and controls
88 lines (71 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# Write your in_range function here:
def in_range(num, lower, upper):
if num >= lower and num <= upper:
return True
else:
return False
# Uncomment these function calls to test your in_range function:
print(in_range(10, 10, 10))
# should print True
print(in_range(5, 10, 20))
# should print False
# Write your same_name function here:
def same_name(your_name, my_name):
if your_name == my_name:
return True
else:
return False
# Uncomment these function calls to test your same_name function:
print(same_name("Colby", "Colby"))
# should print True
print(same_name("Tina", "Amber"))
# should print False
# Write your always_false function here:
def always_false(num):
if num > 10 and num < 10:
return True
else:
return False
# Uncomment these function calls to test your always_false function:
print(always_false(0))
# should print False
print(always_false(-1))
# should print False
print(always_false(1))
# should print False
# Write your movie_review function here:
def movie_review(rating):
if rating <= 5:
return "Avoid at all costs!"
elif rating > 5 and rating < 9:
return "This one was fun."
elif rating >= 9:
return "Outstanding!"
else:
return "None!"
# Uncomment these function calls to test your movie_review function:
print(movie_review(9))
# should print "Outstanding!"
print(movie_review(4))
# should print "Avoid at all costs!"
print(movie_review(6))
# should print "This one was fun."
# Write your max_num function here:
def max_num(num1, num2, num3):
if num1 > num2 and num1 > num3:
return num1
elif num2 > num1 and num2 > num3:
return num2
elif num3 > num1 and num3 > num2:
return num3
else:
return "It's a tie!"
# Uncomment these function calls to test your max_num function:
print(max_num(-10, 0, 10))
# should print 10
print(max_num(-10, 5, -30))
# should print 5
print(max_num(-5, -10, -10))
# should print -5
print(max_num(2, 3, 3))
# should print "It's a tie!"