-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy patherickson.py
35 lines (32 loc) · 1.31 KB
/
erickson.py
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
# 1. define a function
# 2. convert all inputs into parameters
# 3. indent remaining code so that it's part of function
# 4. call the function, passing appropriate values
# 5. obtain values using helpers
print("This program will determine the color of the Roulette pocket number entered.")
from helpers import getNum
def pocketPicker(pocket = 0): # 1, 2 # 5 vvv
pocket = getNum("", 0, 36, float("inf"), convertToInt=True, invalidMsg="That is not a Roulette pocket number.")
if(pocket == 0): # 3
print("Pocket", pocket, "is Green.")
elif(1 <= pocket <= 10):
if((pocket % 2) == 0):
print("Pocket", pocket, "is Black.")
else: print("Pocket", pocket, "is Red.")
elif(11 <= pocket <= 18):
if((pocket % 2) == 0):
print("Pocket", pocket, "is Red.")
else: print("Pocket", pocket, "is Black.")
elif(19 <= pocket <= 28):
if((pocket % 2) == 0):
print("Pocket", pocket, "is Black.")
else: print("Pocket", pocket, "is Red.")
elif(29 <= pocket <= 36):
if((pocket % 2) == 0):
print("Pocket", pocket, "is Red.")
else: print("Pocket", pocket, "is Black.")
else: print(pocket, "is not a valid pocket number.")
pocketPicker(-5) # 4
pocketPicker(34)
pocketPicker(8)
pocketPicker(50)