-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathAlienColor.py
More file actions
58 lines (26 loc) · 1.29 KB
/
AlienColor.py
File metadata and controls
58 lines (26 loc) · 1.29 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
#AlienColor.py
# This class was written by Adejumo Adeyemi Oluwaseun
# by using a random number generator to simulate and
# Alien Shooting Game and printing the corresponding
# reward to the Game Player
from random import randint
class AlienColor:
def __init__(self):
self.alien_color=["green","yellow","red"]
self.randomNumber=randint(0, 2)
self.anotherRandomNumber=randint(0, 2)
def colorTest(self):
if(self.alien_color[self.randomNumber]=="green"):
print("You just earned 5 points")
def anotherColorTest(self):
if(self.alien_color[self.randomNumber]=="green"):
print("You just earned 5 points")
else:
print("You just earned 10 points")
def anotherAnotherColorTest(self):
if(self.alien_color[self.randomNumber]=="green"):
print("You just earned 5 points")
elif(self.alien_color[self.randomNumber]!="yellow"):
print("You just earned 10 points")
else:
print("You just earned 15 points")