mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-08-07 15:26:45 +02:00
[python3/en] Add examples to Bool operators with ints (#2639)
This commit is contained in:
@@ -71,11 +71,14 @@ True and False # => False
|
|||||||
False or True # => True
|
False or True # => True
|
||||||
|
|
||||||
# Note using Bool operators with ints
|
# Note using Bool operators with ints
|
||||||
|
# False is 0 and True is 1
|
||||||
|
# Don't mix up with bool(ints) and bitwise and/or (&,|)
|
||||||
0 and 2 # => 0
|
0 and 2 # => 0
|
||||||
-5 or 0 # => -5
|
-5 or 0 # => -5
|
||||||
0 == False # => True
|
0 == False # => True
|
||||||
2 == True # => False
|
2 == True # => False
|
||||||
1 == True # => True
|
1 == True # => True
|
||||||
|
-5 != False != True #=> True
|
||||||
|
|
||||||
# Equality is ==
|
# Equality is ==
|
||||||
1 == 1 # => True
|
1 == 1 # => True
|
||||||
|
Reference in New Issue
Block a user