Advertisement
David90278

Raspberry Pi - Programming 101 - Bot Quiz

Feb 22nd, 2020
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.01 KB | None | 0 0
  1. phrase = input("talk to me>")
  2. if phrase == "hi" or phrase == "hey" or phrase == "yo" or phrase == "sup?":
  3.     print("hello")
  4. elif phrase == "whats your name?" or phrase == "what's your name?" or phrase == "who are you?":
  5.     print("My name is Rotellity, the maths bot")
  6. else:
  7.     print("sorry I dont understand" + " " + phrase + " I am a maths bot after all!")
  8. username = input("What's your name?")
  9. print("hello " + username)
  10. phrase = input("do you want to play a game?")
  11. if phrase == "yes" or phrase == "yeah" or phrase == "hell yeah!":
  12.     print("brilliant! let's get started!")
  13. elif phrase == "no" or phrase == "no way!" or phrase == "nah":
  14.     print("aw come on now, it will be fun! let's give it a go!")
  15. else:
  16.     print("I am a simple maths bot and cannot understand " + phrase + " so I will accept that as a yes! Let's get started!")
  17. phrase = input("how many eggs are in a carton of a dozen eggs?")
  18. if phrase == "twelve" or phrase == "12":
  19.     print("yes indeed, " + username + " you are correct!")
  20. else:
  21.     print("I'm sorry, " + username + " the answer I was looking for is 12!")
  22. phrase = input("now for a more tricky question: how many minutes are there in a 24 hour perdiod? We will make this one multiple choice! Is it 1,200 minutes, 1,440 minutes or 1,620 minutes?")
  23. if phrase == "1,440" or phrase == "1440" or phrase == "1,440 minutes" or phrase == "1440 minutes":
  24.     print("absolutely correct! You got it " + username + " !")
  25. else:
  26.     print("Good effort " + username + " ! " + "Unfortunately the correct answer is 1,440 minutes.")
  27. phrase = input("ok let's do one last question: how many hours are there in a typical year, ie not a leap year? Are there 8,760 hours, 12,624 hours or 14,848 hours?")
  28. if phrase == "8760" or phrase == "8760 hours" or phrase == "8,760" or phrase == "8,760 hours":
  29.     print("ding ding ding, we have a winner! Good job " + username + " !")
  30. else:
  31.     print("No, I'm sorry " + username + " the correct answer is 8,760 hours.")
  32. print ("thank you for participating in my quiz. goodbye!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement