Skip to content

Instantly share code, notes, and snippets.

@emarte91 emarte91/Magic8Ball.py
Last active May 24, 2019

Embed
What would you like to do?
Simple magic 8 ball program
import random
def magic8Ball():
print("Welcome to the Magic 8 Ball")
x = input("What is your question my child?")
answerList = ["It is certain",
"Outlook good",
"You may rely on it",
"Ask again later",
"Concentrate and ask again",
"Reply hazy, try again",
"My reply is no",
"My sources say no"]
randomAnswer = random.choice(answerList)
if x == "":
print("Please ask a question buddy!")
exit()
else:
print(randomAnswer)
askAgain()
def askAgain():
x = input("Would you like to ask the Magic 8 Ball another question? Y/N")
if x == "Y" or x == "y":
magic8Ball()
else:
print("Thanks for visiting the Magic 8 Ball")
exit()
magic8Ball()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.