Advertisement
jbonanno

teacher.py

Jul 22nd, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.79 KB | None | 0 0
  1.  
  2. #Indicates a random item is selected
  3. from random import choice
  4.  
  5. print ( " I am the teacher and I'm asking you questions about the colors.")
  6. #A questions list is created.
  7. questions =["What color is the sky?", "What color is the ocean?", "What color are blueberries?"]
  8. #A random question is selected from the above list.
  9. question = choice(questions)
  10. #The answer the student states is put into lower case lettering so there are no case sensitivity issues.
  11. answer = input(question).lower()
  12.  
  13. #While the student doesn't answer blue the teacher continues to ask what color the object is.
  14. while answer != "blue":
  15.      answer = input("Tell me again what color it is: ").strip().lower()
  16. #When the student types blue in any case the teacher rewards the student.
  17. print ("You got it right! Here's a sticker")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement