Binary Decisions
if and else statements
if and else statements
if (boolean condition):
# if's code block
code here
else:
# else's code block
# end of the conditionals
code continues here# Code Example 1
num = 100
if num < 0 and num > 100:
print(num, 'is invalid.')
else:
print(num)
# since the if statement's condition is False we get to execute just the print(num) statementLast updated