Page 112 - Code Craft Computer-7
P. 112
On running the above program, we get the following output:
Flashback Time
¨ The if statement is the simplest conditional statement.
¨ In the if else statement, if the condition evaluates to True, the indented block following the if
statement is executed, otherwise the indented block after the else statement is executed.
¨ Python allows the nested if statement.
¨ The if...elif else ladder helps us to test multiple conditions and follows a top-down approach.
Knowledge Check
A. Mark the correct response.
1. Which of the following conditional statements is used to test multiple OMR Sheet
conditions?
Use only blue/black ball
a. if b. if...else pen to fill the circles. It
should be darkened
c. if...elif...else d. All of these completely and properly.
Wrong methods
2. What will be the output of the following code, if the condition evaluates
to false? Correct method
if (True) :
print("Hello") 1. a b c d
else:
2. a b c d
print("Hi")
a. Hello b. Hi
c. Hello Hi d. None of these
112
Computer-7

