Control Statements
Control Statements
CONDITIONS IN PYTHON(IF
STATEMENT)
• if Statement Syntax:
if expression:
Statement
else:
Statement
NESTED IF EXAMPLE
i=0
while i < 10:
print(i)
i += 1
WHILE LOOP
a=int(input(“Enter a number”))
i=1
while i<=10:
p=a*i
print(p)
i=i+1
WHILE LOOP
i=0
while i <= 10:
print(i)
i += 1
else:
print("we have already printer 0 to 10")
FOR LOOP
• With the break statement we can stop the loop even if the while/for condition is
true
if i == 5:
break
print(i)
i += 1
THE CONTINUE STATEMENT
for i in li:
if(i =='a'):
pass
else:
print(i)