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")
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")
Python If Boolean example
def a_bigger(a, b):
if a > b and (a - b) >= 2:
return True
else:
return False
## Can all be written as just
## return (a > b and (a - b) >= 2)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us