Multi Way Selection and Summaries
Multi Way Selection and Summaries
if mark<100:
if mark>90:
grade = 'A+'
print ("Your grade is ",grade)
else:
grade = 'A'
print ("Your grade is ",grade)
else:
print ("Your grade more than 100")
Slide 4- 11
Checking Numeric Ranges
with Logical Operators
Slide 4- 14
• Validating User Input
Slide 4- 16
• Summaries Decision and Selection
– Example using Python language
condition
This must be a True if condition:
True statement
statement False
Example 1: Printing a number only if it is a negative
n<0
if n<0:
True
print (“n is “,n)
print False
n
Decision Structure – IF / ELSE
Pattern 2
if condition:
statement_1
condition True statment_1
else:
False
statement_2
statment_2
Decision Structure – If/Elif/Else
Pattern 3 if condition_1:
statement_1
False
statement_2
elif condition_n:
False else:
statment_m
statement_m
Tutorial 1
Draw a flow chart and write a
program to determine the grade of
user marks.
Slide 4- 23
Tutorial 2
Draw a flow chart and write a program to calculate A, Ix and Iy
based on selection from user.
Computer Programming 24