04-27-2013, 04:48 PM
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
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