-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpractice11.py
More file actions
22 lines (19 loc) · 743 Bytes
/
practice11.py
File metadata and controls
22 lines (19 loc) · 743 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""
5-3. Alien Colors #1: Imagine an alien was just shot down in a game. Create a
variable called alien_color and assign it a value of 'green', 'yellow', or 'red'.
Write an if statement to test whether the alien’s color is green. If it is, print
a message that the player just earned 5 points.
Write one version of this program that passes the if test and another that
fails.
"""
#5-3
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
else:
print("player earned 0 points") #else way
i+=1