Answers for "truthy falsy python"

0

truthy falsy python

# use bool() method to find the truthy/falsy value of different objects
# Ex:

# truthy/falsy lists
l = []
print(bool(l))
l = [1]
print(bool(l))

# truthy/falsy integers
n = 0
print(bool(n))
n = 1
print(bool(n))

# truthy/falsy strings
s = ""
print(bool(s))
s = "a"
print(bool(s))

# and so on...
Posted by: Guest on January-22-2022

Python Answers by Framework

Browse Popular Code Answers by Language