Page 96 - Trackpad_V2.1_class8
P. 96
else:
statement(s)
else:
statement(s)
Program 4: To determine which number is greater among three numbers
Program4.py
File Edit Format Run Options Window Help
#Program to determine which number is greater among three numbers
num1 = int(input('Enter the First Number: '))
num2 = int(input('Enter the Second Number: '))
num3 = int(input('Enter the Third Number: '))
if(num1>num2):
if(num1>num3):
print('First number is the greatest number.')
else:
print('Third number is the greatest number.')
else:
if(num2>num3):
print('Second number is the greatest number.')
else:
print('Third number is the greatest number.')
Output
Output: Enter the First Number: 12 Just as the heart repeatedly pumps
blood, iteration in programming
Enter the Second Number: 45
involves repeatedly running a set of
Enter the Third Number: 23
instructions.
Second number is the greatest number.
ITERATIVE STATEMENTS
Iterative statements refer to the statements that are used to repeat a task based on a given
condition. These statements are also known as looping statements. An iteration means one pass
of a loop.
Python provides the following iterative statements:
(i) For loop (ii) While loop
94 Trackpad (V2.1)-VIII

