Skip to content

Created Magic 8 Ball Game #815

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions Magic8Ball
Original file line number Diff line number Diff line change
@@ -0,0 +1,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()