Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with if syntax
#1
Hello. I am trying to write a little game, and I am using an if statement (which I have used before, even in this same file they work) and it says my syntax is wrong and I can't figure it out. Any help is appreciated:
print "After another 10 minutes of walking, you hear something sneak up on you. You look behind you and see that it is another monster!"
answer = raw_input("Do you run or try to shoot it? (Run, shoot) ".lower()
if answer == "run" and gun > 0 and bullets > 0 and drinks == 6 :
print "You line up a shot. You narrowly miss it, thanks to your thirst."

It highlights the colon and says "Invalid syntax"

did a little type in the code, "run" should be "shoot", but the syntax error is still there.

and yes, the print is indented
Reply
#2
I found it. The parenthesis was BEFORE the quote. My fault
Reply
#3
Good job finding the problem, I've reported the thread for you so a mod can lock it.

Have a nice day.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)