0% found this document useful (0 votes)
48 views

Praveen Python 1.1

The document is a worksheet containing programs written in Python. The first program takes two numbers as input and performs arithmetic operations like addition, subtraction, multiplication, and division on them. The second program takes marks in 5 subjects as input, calculates the total, average, and percentage. The third program converts the input length in centimeters to its equivalent in meters and kilometers. The document contains the code for each program and screenshots of the outputs.

Uploaded by

Kumari Priti
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)
48 views

Praveen Python 1.1

The document is a worksheet containing programs written in Python. The first program takes two numbers as input and performs arithmetic operations like addition, subtraction, multiplication, and division on them. The second program takes marks in 5 subjects as input, calculates the total, average, and percentage. The third program converts the input length in centimeters to its equivalent in meters and kilometers. The document contains the code for each program and screenshots of the outputs.

Uploaded by

Kumari Priti
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/ 4

DEPARTMENT OF

COMPUTER SCIENCE & ENGINEERING

WORKSHEET 1.1

Student Name: Praveen Kumar UID: 21BCS7724


Branch: CSE Section/Group:718 A
Semester: 4th Date of Performance:13/02/2023
Subject Name: Programming in python Lab Subject Code: 21CSP-259

1. Aim:
 Write a program to enter two numbers and perform all arithmetic operations.
 Write a program to enter marks of five subjects and calculate total, average and
percentage.
 Write a program to enter length in centimeter and convert it into meter and kilometer,
and also convert the same into Equivalents

2. Source Code:

1. #CODE TO PERFORM ARITHMETIC OPERATION

num1 = int(input("Enter number : "))

num2 = int(input("Enter number : "))

add = num1 + num2

sub = num1 - num2

mul = num1 * num2

div = num1 / num2


DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

mod = num1 % num2

print("ADDITION OF BOTH NUMBERS : ",add)

print("SUBTRACTION OF BOTH NUMBERS : ",sub)

print("MULTIPLICATION OF BOTH NUMBERS : ",mul)

print("DIVISION OF BOTH NUMBERS : ",div)

print("MODE OF BOTH NUMBERS : ",mod)

2 #CODE TO FIND TOTAL, AVERAGE, PERCENTAGE

print("Enter Number of following subjects out of 100")

maths = int(input("maths : "))

phy = int(input("physics : "))

chem = int(input("chemistry : "))

py = int(input("python : "))

eng = int(input("english : "))

total = maths + phy + chem + py + eng

avg = total/5

perc = total/500 *100

print("TOTAL MARKS OF ALL SUBJECT : ", total)

print("AVRAGE MARKS OF ALL SUBJECT : ", avg)

print("PERCENTAGE : ", round(perc,2),"%")


DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

3 #CODE TO CONVERT cm TO m AND km

num_cm = int(input("ENTER NUMBER IN CENTIMETER : "))

num_m = num_cm/100

print(num_cm,"cm = ",num_m,"m")

num_km = num_cm/ (100 * 1000)

print(num_cm,"cm = ",num_km,"km")

3. Screenshot of Outputs:

1
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

You might also like