Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. import random
  2. def Magic8Ball():
  3. random_number = random.randint(1,20)
  4. question = raw_input("What is your question? ")
  5. print "Magic 8-Ball says:",
  6. if random_number==1:
  7. print "It is certain."
  8. elif random_number==2:
  9. print "It is decidely so."
  10. elif random_number==3:
  11. print "Without a doubt."
  12. elif random_number==4:
  13. print "Yes - definitely."
  14. elif random_number==5:
  15. print "Very doubtful."
  16. elif random_number==6:
  17. print "You may rely on it."
  18. elif random_number==7:
  19. print "As I see it, yes."
  20. elif random_number==8:
  21. print "Most likely."
  22. elif random_number==9:
  23. print "Outlook good."
  24. elif random_number==10:
  25. print "Yes."
  26. elif random_number==11:
  27. print "Signs point to yes."
  28. elif random_number==12:
  29. print "Reply hazy, try again."
  30. elif random_number==13:
  31. print "Ask again later."
  32. elif random_number==14:
  33. print "Better not tell you now."
  34. elif random_number==15:
  35. print "Cannot predict now."
  36. elif random_number==16:
  37. print "Concentrate and ask again."
  38. elif random_number==17:
  39. print "Don't count on it."
  40. elif random_number==18:
  41. print "My reply is no."
  42. elif random_number==19:
  43. print "My sources say no."
  44. elif random_number==20:
  45. print "Outlook not so good."
  46. print
  47. choice = raw_input("Do you want to ask the Magic 8-Ball another question? 'Yes' or 'No'? ")
  48. while choice == 'No':
  49. print "Thank you for using the Magic 8-Ball."
  50. break
  51. while choice == 'Yes':
  52. Magic8Ball()
  53. break
  54. Magic8Ball()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement