Page 39 - Modular v1.1 Pyhton
P. 39
B. Write 'T' for true and 'F' for false.
1. The if…else statement is the simplest conditional statement. ……………………
2. Python does not allow nested if statement. ……………………
3. The if…elif…else ladder is not a conditional statement in Python. ……………………
4. The if statement executes a command if the provided condition evaluates to true. ……………………
5. The if...elif...else statement allows you to test multiple conditions. ……………………
C. Fill in the blanks using the words given below.
false, if, true, else
1. The …………………… statement is the simplest conditional statement.
2. In Python, the non-zero value is interpreted as …………………… .
3. Decision statements may give the results true or …………………… .
4. The …………………… block will be executed if and only if the provided condition evaluates to false.
D. Short answer type questions.
1. What is decision making statement?
2. Write the syntax for the if…elif…else statement.
3. Write the syntax of the if statement.
E. Long answer type questions.
1. Draw the flowchart for nested if statement.
2. Write a python program to convert centimeters to inches. (Hint: 1 inch = 2.54 cm)
Computational Thinking
F. What will be the output of the following programs?
1. a = int(input("Enter a First Number: "))
b = int (input("Enter a Second Number:"))
if a > b:
print("First number is greater than second number")
else:
print ("Second number is greater than first number")
2. num = 3.4
if num > 0:
print("Positive number")
elif num == 0:
print("Zero")
else:
print("Negative number")
Conditional Statements in Python 37

