forked from lyon1066/RBNA-CoLAB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathA_Pair_of_Pis_Magic_8ball.py
49 lines (36 loc) · 1.31 KB
/
A_Pair_of_Pis_Magic_8ball.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Magic 8 ball - A Pear of Pi's stage 1
import random
# define the list of possible 8 ball answers, setup the array
answers = ["Ask your wife!",
"Stop belly aching",
"Why are you asking me this",
"stop your whining",
"wait until tomorrow and ask",
"how come you can't figure this out yourself",
"be patient, answer might come",
"what is your major malfunction"]
#user_input = "hello"
#Function to start the program
def start():
input("What is your problem man, ask the 8 ball for help and it might answer? \n> ")
# defining function to play again
def play_again():
user_input = input("\nAre you going to bother me again with more questions? \n>").lower()
if user_input == "yes":
#print("User input is: ", user_input)
#print("Type of user_input is ", type(user_input))
return user_input #start()
elif user_input == "no":
#print("User input is: ", user_input)
return exit
else:
return "Please answer yes or no."
# start the program
start()
print("\nThe magic 8-ball says: ", random.choice(answers))
user_input = play_again()
#print(user_input)
while (user_input == "yes"):
start()
print("\nThe magic 8-ball says: ",random.choice(answers))
user_input = play_again()