Page 135 - ComputerGenius_V2.1_Class8
P. 135
2. What does an ‘if’ statement do?
(i) Closes the program (ii) Makes a decision
(iii) Asks for input (iv) Iterates an input
3. Which is the correct output for:
for i in range (1, 10):
print(i)
(i) 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 (ii) 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
(iii) 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 (iv) 1, 2, 3, 4, 5, 6, 7, 8, 9
4. This statement allows the user to check for multiple expression.
(i) for (ii) else
(iii) elif (iv) while
B. Fill in the blanks using the words given below.
True Looping One elif
1. _____________ statement allows us to execute a set of code repeatedly.
2. In if-else statement in Python, there can have _____________ else block.
3. In python, non-zero values are interpreted as _____________.
4. _____________ is used as short for ‘else if’.
C. Answer the following question
1. How many types of conditional statements are there in Python? Write their names.
2. Write the purpose of iterative statements in Python?
3. Write the difference between if and if-else statement.
Control Flow Statements 133

