File tree Expand file tree Collapse file tree 3 files changed +31
-226
lines changed
Expand file tree Collapse file tree 3 files changed +31
-226
lines changed Original file line number Diff line number Diff line change 1+ import random
2+ import time
3+
4+ def magic_8_ball ():
5+ answers = [
6+ "Yes" ,
7+ "No" ,
8+ "Ask again later" ,
9+ "Cannot predict now" ,
10+ "Don't count on it" ,
11+ "Most likely" ,
12+ "Outlook not so good" ,
13+ "Reply hazy, try again"
14+ ]
15+
16+ print ("Welcome to the Magic 8-Ball!" )
17+ time .sleep (1 )
18+
19+ while True :
20+ question = input ("Ask me a yes-or-no question (or type 'exit' to end): " )
21+ if question .lower () == 'exit' :
22+ print ("Goodbye!" )
23+ break
24+
25+ print ("Shaking the Magic 8-Ball..." )
26+ time .sleep (2 )
27+ answer = random .choice (answers )
28+ print (f"The Magic 8-Ball says: { answer } \n " )
29+
30+ if __name__ == "__main__" :
31+ magic_8_ball ()
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments