Module-3
Control statement
Iterative statement
   Content
• If/else
• Elif
• Iterative statement
                     Control Statement
• flow of any program is called control statement.
• There are two types of control statement:-
• 1 Selection or forward statement:-
               if
               else if
               elif
               nested if
• 2 loop or iteration statement:-
           2 loop or iteration statement:-
• loop is a repetation of a same task.
A for loop:-
        Syntax:-
        For var_name in range(start,end+1,enc/dec):
              Statement executed until condition is true
                           A if statement
a if
If is a selection or conditional statement which is only execute true
statement.
Syntax:-
If codition:
  Statement is executed when condition is true
Example 1:
age=20
If age(20)>=18:# yes or NO
        Print(“he is eligible for give vote!!!”)
                          if else statement
If else :-
Syntax:-
If condition:
    Statement executed when condition is true
Else:
  Statement executed when condition is false
                               elif statement
Syntax:-
If condition1:
  Statement executed when condition 1 is true
elif condition2:
   Statement 2 executed when condition true
elif condition 3:
    Statement executed when condition 3 is true
elif condition_n:
    statement executed when condition n is true
else:
   false block
                                   example
age=60
if age>=0 and age<=10:
   print("You are child!!!!")
elif age>=11 and age<=16:
   print("You are teenager")
elif age>=17 and age<=22:
   print("Your are adult")
elif age>=23 and age<=35:
   print("You are young!!!!")
else:
   print("He is Sinier citizen")
                         While loop:-
Syntax:-
Var_name=start
While condition:
  Statement executed until condition is true
Increament/decreament
                            Example
1 print a number from 1 to 10 by using while loop
i=1
While i<=10:
     print(i)
     i=i+1
Thank you