Added another example which returns False (#22794)
This commit is contained in:
@ -50,6 +50,7 @@ There are three Boolean Operators they are `and`, `or`, and `not`.
|
|||||||
print(bool(-4)) # Returns True as -4 is a non-zero value
|
print(bool(-4)) # Returns True as -4 is a non-zero value
|
||||||
print(bool(0)) # Returns False as it is a zero value
|
print(bool(0)) # Returns False as it is a zero value
|
||||||
print(bool('dskl')) # Returns True as the string is a non-zero value
|
print(bool('dskl')) # Returns True as the string is a non-zero value
|
||||||
|
print(bool('')) # Returns False as the string is a zero value
|
||||||
print(bool([1, 2, 3])) # Returns True as the list is a non-zero value
|
print(bool([1, 2, 3])) # Returns True as the list is a non-zero value
|
||||||
print(bool((2,3,4))) # Returns True as tuple is a non-zero value
|
print(bool((2,3,4))) # Returns True as tuple is a non-zero value
|
||||||
print(bool([])) # Returns False as list is empty and equal to 0 according to truth value testing
|
print(bool([])) # Returns False as list is empty and equal to 0 according to truth value testing
|
||||||
|
Reference in New Issue
Block a user