jbonanno icon

teacher.py

jbonanno | PRO | 07/22/17 12:00:48 PM UTC | 0 ⭐ | 247 👁️ | Never ⏰ | []
Python |

790 B

|

None

|

0 👍

/

0 👎

 
#Indicates a random item is selected
from random import choice
 
print ( " I am the teacher and I'm asking you questions about the colors.")
#A questions list is created. 
questions =["What color is the sky?", "What color is the ocean?", "What color are blueberries?"]
#A random question is selected from the above list.
question = choice(questions)
#The answer the student states is put into lower case lettering so there are no case sensitivity issues.
answer = input(question).lower()
 
#While the student doesn't answer blue the teacher continues to ask what color the object is. 
while answer != "blue":
     answer = input("Tell me again what color it is: ").strip().lower()
#When the student types blue in any case the teacher rewards the student.
print ("You got it right! Here's a sticker")

Comments