-
Notifications
You must be signed in to change notification settings - Fork 520
Expand file tree
/
Copy pathMagic8Ball
More file actions
26 lines (19 loc) · 884 Bytes
/
Magic8Ball
File metadata and controls
26 lines (19 loc) · 884 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
import random
responses = ['It is certain','It is decidedly so','Without a doubt','Yes definitely ','You may rely on it','As I see it, yes','Most likely ','Outlook good','Yes','Signs point to yes','Do not count on it','My reply is no',' My sources say no',' Outlook not so good','Very doubtful', 'Reply hazy try again','Ask again later','Better not tell you now ','Cannot predict now ','Concentrate and ask again']
print("Hi! I am the magic 8 ball, what's your name?")
name = input()
print("Hello!"+ name)
def magic8Ball():
print("Whay's your question? ")
question = input()
answer = responses[random.randint(0,len(responses)-1)]
print(answer)
tryAgain()
def tryAgain():
print("Do you wanna ask any more questions? press Y for yes and any other key to exit ")
x = input()
if(x == 'Y'):
magic8Ball()
else:
exit()
magic8Ball()