Chapter_6
Chapter_6
FLOW OF CONTROL
1. What is Flow of control in python?
➢ The order of execution of the statements in a program is
known as Flow of control.
➢ It can be implemented using control structures.
if condition:
statement(s)
Example:
Example:
n=int (input (“Enter the number:”))
if n>0:
print (“Positive number”)
else:
print (“Negative number”)
Example:
n=int (input (“Enter the number:”))
if n>0:
print (“Positive number”)
elif n==0:
print(“ZERO”)
else:
print (“Negative number”)
Example:
for i in range (1,10):
print(i)
Flowchart:
Example:
i=0
while i<=5:
print(i)
i+=1
********************************************