Dariush
0
Q:

boolean python example

# Booleans represent one of two values: True or False.
# When you compare two values, the expression is evaluated and Python returns the Boolean answer:
print(10 > 9)
> True
print(10 < 9)
> False
# All True Examples
bool("abc")
bool(123)
bool(["apple", "cherry", "banana"])
# All False Examples
bool(False)
bool(None)
bool(0)
bool("")
bool(())
bool([])
bool({})
5
#Example I found:

my_boolean = 1
print(bool(my_boolean))

my_boolean = 0
print(bool(my_boolean))

my_boolean = 10
print(bool(my_boolean))

print("Coding" == "fun")
0
checker = None 

if some_decision:
    checker = True

if checker:
    # some stuff
-1

New to Communities?

Join the community