1# Import the modules
2import sys
3import random
4
5ans = True
6
7while ans:
8 question = raw_input("Ask the magic 8 ball a question: (press enter to quit) ")
9
10 answers = random.randint(1,8)
11
12 if question == "":
13 sys.exit()
14
15 elif answers == 1:
16 print "It is certain"
17
18 elif answers == 2:
19 print "Outlook good"
20
21 elif answers == 3:
22 print "You may rely on it"
23
24 elif answers == 4:
25 print "Ask again later"
26
27 elif answers == 5:
28 print "Concentrate and ask again"
29
30 elif answers == 6:
31 print "Reply hazy, try again"
32
33 elif answers == 7:
34 print "My reply is no"
35
36 elif answers == 8:
37 print "My sources say no"
38