Answers for "if condition with boolean in python"

0

python3 conditional with boolean

a = True  # case sensitive, so use True or False
# or
x = 0
a = bool(x)  # this is False, any other number is True
# or
x = 'Non-empty string'
a = bool(x) # this is True 

if a == True:
     print("a is true")
Posted by: Guest on October-07-2021
0

python if boolean logic

def if_demo(s):
  if s == 'Hello' or s == 'Hi':
    s = s + ' nice to meet you'
  else:
    s = s + ' woo hoo!'
  return s
Posted by: Guest on October-08-2021

Code answers related to "if condition with boolean in python"

Python Answers by Framework

Browse Popular Code Answers by Language