Reputation: 990
I see this code used on Python 2 library:
if a <> '0'
but in Python 3 it throws an error:
SyntaxError: invalid syntax
Now I'm not totally sure if the comparison is similar to:
if a < '0' and a > '0'
Or does it mean something else?
Upvotes: 0
Views: 63
Reputation: 630
If values of two operands are not equal, then condition becomes true. for example (1 <> 2) is true. This is similar to != operator.
in your case use
if a != '0'
Upvotes: 1