Boolean values¶
Boolean values are used in the following examples:
>>> x = False
>>> x
False
>>> not x
True
>>> y = True * 2
>>> y
2
Apart from their representation as True
and False
, Boolean values
behave like the numbers 1
(True
) and 0
(False
).
Checks¶
Decide whether the following statements are true or false:
1
0
-1
[0]
1 and 0
1 > 0 or []