Code is not passing through

print("Welcome to my house!")

play = input("Want to play a game? ")
##no
# print(play)
if play.lower != "yes":
    quit()
   ## print("Quitting game")
print("Great! Let's play")
score = 0

answer = input("What is the color of the sky? ")
if answer.lower() == "blue":
    print("Correct!")
    score += 1
else:
    print("Incorrect!") 

answer = input("What are the colors of the sun? ")
if answer.lower() == "orange, red, yellow":
    print("Correct!")
    score += 1
else:
    print("Incorrect!") 

answer = input("What is the color of the grass? ")
if answer.lower() == "green":
    print("Correct!")
    score += 1
else:
    print("Incorrect!") 

answer = input("What is the color of Hover dam? ")
if answer.lower() == "gray":
    print("Correct!")
    score += 1
else:
    print("Incorrect!") 

answer = input("What is the color of the Xbox 360? ")
if answer.lower() == "black":
    print("Correct!")
    score += 1
else:
    print("Incorrect!") 


print("Your scored " + score + "points")

if score < 3 :
    print("Try again next time.")
else: 
    print("Congrats! You passed.") 

I get stuck when i enter no nothing happens which is good, but when i enter yes still nothing happens? Its not in the curriculum but trying to get this to work any suggestions?

I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

lower is function
so call it like this
play.lower()

Thank you so much got it to work now

1 Like

Another approach to this quiz would make the code DRY (Do Not Repeat Yourself).

score = 0

def ask_question (question, correct_answer):
  answer = input(question + " ")
  if answer.lower() == correct_answer:
    print("Correct!")
    global score
    score += 1
  else:
    print("Incorrect!") 

print("Welcome to my house!")
play = input("Want to play a game? ")

if play.lower() != "yes":
  quit()

print("Great! Let's play")

questions = (
  ("What is the color of the sky?", "blue"),
  ("What are the colors of the sun?", "orange, red, yellow"),
  ("What is the color of the grass?", "green"),
  ("What is the color of Hover dam?", "gray"),
  ("What is the color of the Xbox 360?", "black")
)

for question in questions:
  ask_question(question[0], question[1])

print("Your scored " + str(score) + " points")

if score < 3 :
    print("Try again next time.")
else: 
    print("Congrats! You passed.")