Decision making &_loops_in_python5. 1) if CONDITION
if expression:
statement(s)
SYNTAX
if (expression):
statement(s)
FLOWCHART
or
7. 2) if ... else CONDITION
if expression:
statement(s)
SYNTAX
else :
statement(s)
FLOWCHART
9. 3) if … elif … else CONDITION
if expression:
statement(s)
SYNTAX
elif (expression):
statement(s)
FLOWCHART
else :
statement(s)
12. 4) NESTED if
if expression:
statement(s)
SYNTAX
if (expression):
statement(s)
else:
statement(s)
else :
statement(s)
FLOWCHART
16. WHAT ARE LOOPS?
•Loops are the set of
instruction which allows
us to execute a statement
or group of statements
multiple times.
18. TYPES OF LOOP
• The different types of looping statement are:-
Loop
For loop While loop
20. EXAMPLE OF “WHILE LOOP”
Q. Write a program for sum of integer upto ‘n’ by using while loop.
condition
Conditional code
23. EXAMPLE OF “FOR LOOP”
Q.Write a program for sum of integer upto ‘n’ by using for loop.
Actual written program
Increment factor
(in-built RANGE)
Final value
Initial value
variable