Python Conditionals
Python Conditionals
1|Page
Example Code: Example Code:
x = 5 x = 7
if x > 5: result = 'x is greater than 5' if
x > 5 else 'x is not greater than
print('x is greater than 5')
5'
elif x == 5:
print(result)
print('x is equal to 5')
else:
print('x is less than 5')
Output:
Output:
x is equal to 5
x is greater than 5
2|Page