Worksheet
Student Name:Anukrati sachan Branch: CSE
Semester: 4th Subject Name : Python lab
UID:20BCS7238
Section/Group : ON20BCS714-A
Q1. Write a program c to enter two number and perform all the arithmetic
operations.
a = eval(input("Enter the First Number : "))
b = eval(input("Enter the Second Number : "))
#Arthematic operation are ass following
"""Addition"""
c = a+b
print("The Sum of the number is : ", c)
"""Substraction"""
c = a-b
print("The difference of the number is : ", c)
"""Multiply"""
c = a*b
print("The Product of the number is : ", c)
Code:
"""Division"""
c = a/b
print("The quotient of the number is : ", c)
Output:=
Q2 Write a program to enter the marks of five subjects and calculate total, average and
percentage.
Code:
print("Enter The Marks of five Subject : ") a = int(input("First : "))
b = int(input("Second : "))
c = int(input("Third : "))
d = int(input("Fourth : "))
e = int(input("Fifth : "))
#total marks
total= (a+b+c+d+e)
print("The total marks = : ", total) #average calculation
Avg = total/5
print("Average marks = ",Avg) #percentage
perc = (total/500)*100
print("the percentage of Marks in 5 subject is ",perc)
Output:-
Q3. Write a program to enter the length in a centimeter and convert it into meter and
kilometer, and also convert the same Equivalents.
Code:
a = float(input("Enter the Length in centimeter : "))
m = a/100
km =
a/100000
yard =
a/91.44 foot
= a/ 30.48
inch = a/ 2.54
a= int(a)
print("The lenth of ", a ," centimeter in Meter = ", m)
print("The lenth of ", a ," centimeter in Kilometer = ", km)
print("/n----------More equivalents are as followed
-----------------------------------------------------------------------------
Output:-