If statement confusion, can someone help me understand how this is incorrect syntax in python?

twitter logo ・1 min read

Ok, so why is this:

#code before
if state == 1 and (tok == "\"" or tok "'"):
#code after

Incorrect syntax, but:

#code before
if tok == "\"" or tok == "'":
#code after

Can execute without any issues...
Don't know if this helps, but the second one is coming after the first one, and the first one had no trouble executing...

twitter logo DISCUSS (7)
markdown guide
 

The very last comparison in the first one is missing a double equals 🙂

 
 

Don't beat yourself up, I've lost count of how many times I've stared at a screen at length but still missed a small typo like this ... Yet another reason having a fresh set of eyes can be helpful.

 

Maybe its a side effect from doing too much programming in one sitting? I have been programming for 10 hours now...

That very well could be, there are some serious diminishing returns if you keep at it for that long.

I know. I just want to get my project over before the end of today. Could you please view my next post. It would really help. (This is for a bigger project BTW)

 
Classic DEV Post from Oct 8 '18

Who's looking for open source contributors? (October 8th edition)

It's one week into #hacktoberfest! Find something to work on or promote your p...

PDS OWNER CALIN (Calin Baenen) profile image
I am a very interested in making games in Java and making programming languages in Python

dev.to is where software developers stay in the loop and avoid career stagnation.

Sign up (for free)