2.5 True and False
In section 1.1, we saw how you could treat
the bits 0 and 1 like the Booleans
false and true. In Python, we represent these
as False and True.
The not operator inverts them.
not True
False
not False
True
2.5.1 Equality testing
Recall that we use “==” to compare whether two things are
equal. Remember: assignment uses “=” and equality testing uses
“==”.
a = 10
-a == -10
True
a == "10"
False
The last expression shows that the string "10" is not
the same as the number 10. We can, however, create the string representation of a
number.
str(a)
'10'
str(a) == "10"
True
To test if two things are not equal, use “!=”.
"London" != "london"
True