Page 146 - 2622_Delhi Police Public School_C-7
P. 146
Scratch Your Brain. 21 st Century #Critical Thinking
Skills
1. Write the output of the following codes:
a. number = 0
if (number > 0):
print('Positive')
elif (number < 0):
print('Negative')
else:
print('Zero')
b. 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)
c. x = 31
if(x > 10):
print("Above ten")
if(x > 20):
print("and also above 20!")
else:
print("but not above 20.")
2. Find the error in the following code and
rewrite the code:
a. x = 10
if (x > 5):
print("x is greater than 5")
Premium Edition-VII
144

