-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path8ball.py
More file actions
31 lines (28 loc) · 688 Bytes
/
8ball.py
File metadata and controls
31 lines (28 loc) · 688 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
28
29
30
31
import random
import time
answers=[]
answers.append("Yes")
answers.append("Just do it")
answers.append("No")
answers.append("Maybe")
answers.append("Try again")
answers.append("Never")
answers.append("Another day")
answers.append("Perhaps")
answers.append("42")
answers.append("Of course")
answers.append("Turn left")
answers.append("Go ahead")
answers.append("Nope")
def magic8ball():
question=raw_input("What is your Question? ")
print "Thinking...."
time.sleep(3)
return answers[random.randint(0,len(answers)-1)]
still_asking = True
while (still_asking):
print magic8ball()
a=raw_input("Another question? (Y/N) ")
if (a.lower()=="n"):
print "Goodbye!"
still_asking=False