Page 128 - TP_Pluse_V2.2_Class_7
P. 128
10 Conditional Statements
in Python
Let’s surf
Ø Conditional Statements Ø The if Statement
Ø The if…else Statement Ø Nested if Statement
Ø The if…elif…else Ladder
21 st
Let’s PLug-in Century #Critical Thinking
Skills
If a = 8, b = 2 and c = 20, then what will be the output of the following statements:
1. print(a > b and b < c) = _____________________
2. print(a ** b + c) = _____________________
3. print(a, b, c) = _____________________
4. print(a > b or b > c) = _____________________
5. print(a // b – 2 + c) = _____________________
There are situations in life where we must make decisions based on the circumstances. For example,
if it rains, we will stay at home, or else we will visit the market. Similar situations arise in programming
as well, where we need to make some decisions and, based on these decisions, execute a set of
commands. Whether the outcome is true or false, we must decide which action to take and which
statement to execute. In this chapter, we will learn about conditional statements in Python.
CONDITIONAL STATEMENTS
Conditional statements, also known as decision-making or control flow statements, are used in
programming to execute different blocks of code based on certain conditions. The following conditional
statements are available in Python:
if statement
if...else statement
Nested if statement
if…elif…else ladder
126 Plus (Ver. 2.2)-VII

