0% found this document useful (0 votes)
109 views6 pages

Python Week 2: IITM BS in Data Science: - Tutorial 2.1 - Tutorial On If, Else and Else-If (Elif) Conditions

Uploaded by

FFINX
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
109 views6 pages

Python Week 2: IITM BS in Data Science: - Tutorial 2.1 - Tutorial On If, Else and Else-If (Elif) Conditions

Uploaded by

FFINX
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Prof. Sudarshan Iyengar Mr.

Omkar Joshi
Department of Computer Science and Engineering Course Instructor
Indian Institute of Technology Ropar IITM Online Degree Programme
Problem 1: Find whether the given number
is even or odd
Test Cases
Sr. No. Input Expected output
1 4 Even
2 5 Odd
3 0 Even
4 -7 Odd
5 -10 Even

Tutorial on if, else and else-if (elif) conditions 1


Problem 2: Find whether the given number
ends with 0 or 5 or any other number
Test Cases
Sr. No. Input Expected output
1 20 0
2 14 Other
3 5 5
4 0 0
5 -27 Other
6 -10 0

Tutorial on if, else and else-if (elif) conditions 2


Problem 3: Find the grade of student based
on the given marks from 0 to 100
Student grades Test Cases
Sr. No. Grade Marks range Sr. No. Input Expected output
1 A ≥90 1 95 A
2 B ≥80 and <90 2 87 B
3 C ≥70 and <80 3 70 C
4 D ≥60 and <70 4 61 D
5 E <60 5 0 E
6 100 A
7 -5 Invalid input
8 110 Invalid input

Tutorial on if, else and else-if (elif) conditions 3


Problem 4: Convert the given flowchart
into a Python code

Tutorial on if, else and else-if (elif) conditions 4

You might also like