Page 123 - Touchpad_Plus_V3.2_Class 7
P. 123
else:
print('Zero')
2. num1 = 8
num2 = 5
if (num1 % 2 == 0 and num2 % 2 == 0):
result = num1 + num2
print("The sum is:", result)
else:
result = num1 * num2
print("The product is:",result)
3. x = 31
if(x > 10):
print("Above ten")
if(x > 20):
print("and also above 20!")
else:
print("but not above 20.")
F. Find the error in the following code and rewrite the code:
1. x = 10
if (x > 5):
print("x is greater than 5")
2. y = 8
if (y > 5):
print("y is greater than 5")
3. x = 10
if (x = 5):
print("x is equal to 5")
Conditional Statements in Python 121

