mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +00:00
[python3/en] Add examples to Bool operators with ints (#2639)
This commit is contained in:
parent
20b2a9a29d
commit
05e4c41cb3
@ -71,11 +71,14 @@ True and False # => False
|
||||
False or True # => True
|
||||
|
||||
# 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
|
||||
-5 or 0 # => -5
|
||||
0 == False # => True
|
||||
2 == True # => False
|
||||
1 == True # => True
|
||||
-5 != False != True #=> True
|
||||
|
||||
# Equality is ==
|
||||
1 == 1 # => True
|
||||
|
Loading…
Reference in New Issue
Block a user