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