-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython_exercise_page84.py
More file actions
87 lines (60 loc) · 1.85 KB
/
python_exercise_page84.py
File metadata and controls
87 lines (60 loc) · 1.85 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
#esercizio numero 5.3 pagina 84
alien_color = 'green', 'yellow', 'red'
alien_color = 'green'
if alien_color == 'green':
print("You earned 5 points!")
alien_color = 'yellow'
if alien_color == 'yellow':
print("You earned 5 points!")
alien_color = 'red'
if alien_color == 'blue':
print("You earned 5 points!")
#esercizio numero 5.4
alien_color = 'green', 'yellow', 'red'
alien_color = 'green'
if alien_color == 'green':
print("You just earned 5 points for shooting the alien!")
if alien_color != 'green':
print("You just earned 10 points")
alien_color = 'green'
if alien_color == 'green':
print("You just earned 5 points for shooting the alien!")
else:
print("You earned 10 points!")
#esercizio numero 5.5
alien_color = 'green', 'yellow', 'red'
alien_color = 'green'
if alien_color == 'green':
print("You just earned 5 points!")
elif alien_color == 'yellow':
print("You just earned 10 points!")
else:
print("you just earned 15 points!")
alien_color = 'yellow'
if alien_color == 'green':
print("You just earned 5 points!")
elif alien_color == 'yellow':
print("You just earned 10 points!")
else:
print("you just earned 15 points!")
alien_color = 'red'
if alien_color == 'green':
print("You just earned 5 points!")
elif alien_color == 'yellow':
print("You just earned 10 points!")
else:
print("you just earned 15 points!")
#esercizio numero 5.5
age = 23
if age < 2:
print("This person is still a baby")
elif age >= 2 and age < 4:
print("This person is a toddler")
elif age >= 4 and age < 13:
print("This person is a kid")
elif age >= 13 and age < 20:
print("This person is a teenager")
elif age >= 20 and age < 65:
print("This person is an adult")
else:
print("This person is an elder")