Advertisement
shh_algo_PY

Riddle Bot Example

Mar 5th, 2022
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.18 KB | None | 0 0
  1. border = "==============================="
  2. print(border)
  3. hello = input("Hello! How are you today?")
  4. print(border)
  5. print("Just "+hello+"? Are you sure about that?")
  6. hello2 = input("How are you *really* feeling today?")
  7. print("Okay then, I will remember that you said: "+hello2)
  8. print("Now let's move on to some riddles...")
  9. print(border)
  10.  
  11. #===============================================#
  12. # ⚠ NOW CHANGE THE PROGRAM ---> Keep asking until correct answer is given!
  13. #===============================================#
  14.  
  15. answer = "light bulb"
  16. answer2 = "Bulb"
  17. answer3 = "light"
  18. answer4 = "bulb"
  19.  
  20. ans = input("It's a hanging pear that you can't eat: ")
  21.  
  22. #===============================================#
  23. # ⚠ Your "if" is now "while"
  24. #===============================================#
  25. # ⚠ CONSIDER ALL ANSWERS - bulb, light, Bulb...
  26. #===============================================#
  27.  
  28. while not (ans==answer or ans==answer2 or ans==answer3 or ans==answer4):
  29.     ans = input("Wrong, try again: ")
  30. print("That's right!")
  31.  
  32. ##===============================================#
  33. # ✨ BONUS: MAKE IT ASK A NEW QUESTION NEXT!
  34. #===============================================#
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement