0% found this document useful (0 votes)
8 views3 pages

Python Lab Assignmnet 02

Uploaded by

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

Python Lab Assignmnet 02

Uploaded by

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

School of Computer Engineering and Technology

B. Tech. (First Year)

Python Programming [ CSE10040]

ASSIGNMENT NO: 2

Problem Statement:
To find largest of three numbers.

Aim:
Write a python program to find the largest of three numbers.

Objectives:
To learn and implement different forms of if..else statement.

Theory:

Following is the general form of a typical decision-making structure found in most of the
programming languages − Python programming language assumes any non-zero and non-
null values as TRUE, and if it is either zero or null, then it is assumed as FALSE value.
Python programming language provides following types of decision-making statements.
Python programming language assumes any non-zero and non-null values as TRUE, and if
it is either zero or null, then it is assumed as FALSE value.
Syntax & Example:

1. if statements - An if statement consists of a boolean expression followed by one or


more statements.
Example :

var = 100

if ( var == 100 ) : print "Value of expression is 100"print "Good bye!"

2. if...else statements - An if statement can be followed by an optional else statement,


which executes when the boolean expression is FALSE.

Example

if (num>0):

print (“Positive number”)

elif (num<0):

print (“Negative number”)

Platform:
Windows/Ubuntu - Python Editor (Jupyter Notebook, IDLE, or any IDE).

Algorithm / Pseudo code:


Students should write algorithm/pseudo code for the given problem statement.
Input:
Accept three integer numbers from the user.

Output:
Display largest of three integer numbers accepted from the user.

Conclusion:
Studied implementation of different forms of if…else statements using python
programming.

FAQs:
1. Describe following logical and relational operators with suitable examples.

Logical operators: and, or and not

Relational operators: <, >, <=, >=, ==, !=

2. In certain university, grades are assigned to the marks obtained in respective subjects.
Grades are assigned as given below.

Marks obtained Grade assigned


90-100 O
80-89 A+
70-79 A
60-69 B
50-59 C
40-49 P
Below 39 F

Write a python program to accept Marks in Math and display respective grade as an output
using if…elif…elif..else statements (Using multiple conditions).

You might also like