-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpractice12.py
More file actions
27 lines (26 loc) · 977 Bytes
/
practice12.py
File metadata and controls
27 lines (26 loc) · 977 Bytes
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
"""
5-5. Alien Colors #3: Turn your if- else chain from Exercise 5-4 into an if- elif-
else chain.
If the alien is green, print a message that the player earned 5 points.
If the alien is yellow, print a message that the player earned 10 points.
If the alien is red, print a message that the player earned 15 points.
Write three versions of this program, making sure each message is printed
for the appropriate color alien.
"""
#5-5
alien_quantity = int(input("enter a quantity of alien : ")) #definition with input
i = int(0) #iteration control
while(i<alien_quantity):
alien_color = input("enter a color : ")
if(alien_color == 'green'):
print("player earned 5 points") #if way
i+=1
elif(alien_color=='yellow'):
print("player earned 10 points") #new way
i+=1
elif(alien_color=='red'):
print("player earned 15 points") #new way
i+=1
else:
print("player earned 0 points") #else way
i+=1