Python Language Programming Lab
Laboratory Notes (2)
Topic:
1. Write programs to demonstrate the use of control Statements
Objective:
Write programs to demonstrate the use of control Statements
Description:
The Python control statements are as follows:
Python if...else Statement
Python for Loop
Python break and continue
IF Statement
The if…elif…else statement is used in Python for decision making:
Python if Statement Syntax
if test expression:
statement(s)
Example:
num = 3
if num > 0:
print(num, "is a positive number.")
print("This is always printed.")
Syntax of if...else
if test expression:
Body of if
else:
Body of else
Laboratory Notes (2)
Topic:
1. Write programs to demonstrate the use of control Statements
Objective:
Write programs to demonstrate the use of control Statements
Description:
The Python control statements are as follows:
Python if...else Statement
Python for Loop
Python break and continue
IF Statement
The if…elif…else statement is used in Python for decision making:
Python if Statement Syntax
if test expression:
statement(s)
Example:
num = 3
if num > 0:
print(num, "is a positive number.")
print("This is always printed.")
Syntax of if...else
if test expression:
Body of if
else:
Body of else