Page 87 - TP-Play_V-2.0_Book-7
P. 87
On running the above program, we get the following output:
THE IF…ELSE STATEMENT
The if…else statement checks for a condition. If the
condition evaluates to True, the indented block following
Test Expression
the if statement is executed, otherwise the indented
block after the else statement is executed. The syntax of False
True
the if…else statement is given below:
Syntax:
Body of if Body of else
if (Test Expression):
Indented block
else: Statement just below if
Indented block
Program 3: To compare two numbers and print the result
Conditional Statements in Python 87

