#Python Pop Quiz 🐍❓

What is the output when you run this code in the REPL?

A) True
B) False
C) Syntax Error
D) None of the above

Solution 

@driscollis I ran it and was surprised by the error. Why does this fail, but x == (not y) works, as does not x == y? Operator precedence? is `not` not simply a unary operator? Is there something that becomes possible in Python that wouldn't work the C/Java way?

Solution 

@driscollis Even more bizarrely, x is not y works. How are == and `is` not syntactically interchangeable?!

Solution 

@peterdrake @driscollis Wow, that strange, didn't know about that, I always think there were. Seem I was wrong

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.