6-Conditional Blocks Using If, Else and Elif-13-03-2023
6-Conditional Blocks Using If, Else and Elif-13-03-2023
1. SEQUENCE
2. SELECTION
3. ITERATION OR LOOPING
Statement 1
Statement 2
Statement 3
……..
……..
……..
1. SEQUENCE – FLOW CHART
1. SEQUENCE – FLOW CHART
Statement 1
Statement 2
Statement 3
1. SEQUENCE - PROGRAM
1. SEQUENCE - PROGRAM
SELECTIO
N
2. SELECTION
: Colon Must
if first condition:
first body
elif second condition:
second body
elif third condition:
third body
else:
fourth body
CONDITIONAL CONSTRUCT – if else
STATEMENT
FLOW CHART
CONDITIONAL CONSTRUCT – if else
STATEMENT
FLOW CHART
False
Condition ? Statement 1 Statement 2
Main True
Body
Statement 1
else
Statement 2 body
CONDITIONAL CONSTRUCT – if else
STATEMENT
EXAMPLE - PROGRAM
EXAMPLES – if STATEMENT
else is missing,
it is an
optional
statement
OUT
PUT
CONDITIONAL CONSTRUCT
: Colon Must
else is
used
OUT
PUT
CONDITIONAL CONSTRUCT
READ AS
18 is less
than age
and
18 is less
than 60
OUTPU
T
PROGRAM LIST ON if CONTSTUCT
PROGRAM LIST ON if CONTSTUCT
AVERAGE PROGRAMS
5. Write a PYTHON program to evaluate the
student performance
If % is >=90 then Excellent performance
If % is >=80 then Very Good performance
If % is >=70 then Good performance
If % is >=60 then average performance
else Poor performance.
6. Write a PYTHON program to find largest of three
numbers.
7. Write a PYTHON program to find smallest of
three numbers
PROGRAM LIST ON if CONTSTUCT
***