Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- def Magic8Ball():
- random_number = random.randint(1,20)
- question = raw_input("What is your question? ")
- print "Magic 8-Ball says:",
- if random_number==1:
- print "It is certain."
- elif random_number==2:
- print "It is decidely so."
- elif random_number==3:
- print "Without a doubt."
- elif random_number==4:
- print "Yes - definitely."
- elif random_number==5:
- print "Very doubtful."
- elif random_number==6:
- print "You may rely on it."
- elif random_number==7:
- print "As I see it, yes."
- elif random_number==8:
- print "Most likely."
- elif random_number==9:
- print "Outlook good."
- elif random_number==10:
- print "Yes."
- elif random_number==11:
- print "Signs point to yes."
- elif random_number==12:
- print "Reply hazy, try again."
- elif random_number==13:
- print "Ask again later."
- elif random_number==14:
- print "Better not tell you now."
- elif random_number==15:
- print "Cannot predict now."
- elif random_number==16:
- print "Concentrate and ask again."
- elif random_number==17:
- print "Don't count on it."
- elif random_number==18:
- print "My reply is no."
- elif random_number==19:
- print "My sources say no."
- elif random_number==20:
- print "Outlook not so good."
- print
- choice = raw_input("Do you want to ask the Magic 8-Ball another question? 'Yes' or 'No'? ")
- while choice == 'No':
- print "Thank you for using the Magic 8-Ball."
- break
- while choice == 'Yes':
- Magic8Ball()
- break
- Magic8Ball()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement