Magic 8 Ball
# Magic 8 Ball
#
import random
answers = (
"Yes",
"No",
"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",
"Reply hazy, try again",
"Ask again later",
"Better not tell you now",
"Cannot predict now",
"Concentrate and ask again",
"Don't count on it",
"My reply is no",
"My sources say no",
"Outlook not so good",
"Very doubtful"
)
def play():
input("Ask a question out loud, then press Enter ")
print(answers[random.randrange(len(answers))])
print() # leave a blank line
# Keep playing until the user wants to stop
playing = True
while playing:
play()
reply = input("Do you want to play again? ")
if reply[0] in 'Nn':
playing = False