Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python (3.2.3) If Or Statement Syntax Error

Thanks for reading this. I'm trying to do this lab from programarcadegames.com where you have to write a quiz. I finished my first question and got a syntax error. Here's the code:

print ("This is a quiz.")
x=0
questionOne=input("First question! How many fingers does a human have? "
if questionOne == "10" or questionOne.lower() == "ten":
                   print ("Correct! Good job!")
                   x+=1
else:
                   print ("Not quite... try the next one!")
print ("You got the following amount of questions right:",x) 

When I go to run it, I get a syntax error and the Python shell editor window highlights the colon at the end of line four. Removing the colon causes it to highlight print on the next line. I've also tried removing the or statement and just making line four:

 if questionOne == "10":

for the sake of troubleshooting, but I ended up with the same error and red colon. Any ideas? Criticisms? Mocking comments? Thanks again for reading.

EDIT: It wasn't the .lowercase() thing, fixed that.

like image 813
user1586423 Avatar asked Nov 17 '25 20:11

user1586423


1 Answers

You are missing a closing parenthesis on the previous line (the line with input).

like image 53
BrenBarn Avatar answered Nov 20 '25 10:11

BrenBarn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!