converts the given value to a Boolean value ( True or False ). | python bool function| python course

Опубликовано: 02 Июнь 2026
на канале: thepycode
377
50

#python #Boolean #pythoncourse
converts the given value to a boolean value ( True or False ).
bool function in the python
Boolean
1)
   • Boolean in python | python tutorials | Bes...  
Facebook link:
  / 976594952928573  

empty list
mylist = []
print(mylist,'is',bool(mylist))

empty tuple
t = ()
print(t,'is',bool(t))

zero complex number
a = 0 + 0j
print(a,'is',bool(a))

num = 55
print(num, 'is', bool(num))
val = None
print(val,'is',bool(val))

val = True
print(val,'is',bool(val))

empty string
str = ''
print(str,'is',bool(str))

str = 'Hello'
print(str,'is',bool(str))