Page 109 - Trackpad_V5_Book 8
P. 109
Program 3: To grade a student according to his/her marks.
You will get the following output:
THE NESTED if STATEMENTS
Nested if statements mean if statements are placed within another if statement. Python allows us
to write an if statement within another if statement. The syntax of the nested if statement is as
follows:
if (conditional expression1):
statement(s)
Test False Nested test
if (conditional expression2): expression expression
1
statement(s) False
True True
elif (conditional expression3):
statement(s) Body of else Body of Body of
nested if nested else
else:
statement(s)
else: Statement just
below if
statement(s)
Control Structures in Python 107

