DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
WORKSHEET 1.1
Student Name: ansh UID: 21BCS5255
Branch: CSE Section/Group: 617-B
Semester: 4th Date of Performance: 13 Feb 2023
Subject Name: Programing in python Subject Code: 21CSP-259
1. Aim:
a)Write a program to enter two numbers and perform all arithmetic
operations.
b)Write a program to enter marks of five subjects and calculate total, average
and percentage.
c)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:
#Program to input two numbers and performing all arithmetic operations
#Input first number
num1 = int(input("Enter first number: "))
#Input Second number
num2 = int(input("Enter second number: "))
#Printing the result for all arithmetic operations
print("Results:-")
print("Addition: ",num1+num2)
print("Subtraction: ",num1-num2)
print("Multiplication: ",num1*num2)
print("Division: ",num1/num2)
print("Modulus: ", num1%num2)
print("Floor Division: ",num1//num2)
DEPARTMENT OF
print("Exponentiation: ",num1 ** num2)
#Program to enter marks of five subjects and calculate total, average and
percentage.
english = float(input("Please enter English Marks: "))
math = float(input("Please enter Math score: "))
computers = float(input("Please enter Computer Marks: "))
physics = float(input("Please enter Physics Marks: "))
chemistry = float(input("Please enter Chemistry Marks: "))
total = english + math + computers + physics + chemistry
average = total / 5
percentage = (total / 500) * 100
print("\nTotal Marks = " ,total)
print("Average Marks = " ,average)
print("Marks Percentage = " ,percentage)
# Program to enter length in centimeter and convert it into meter and kilometer,
and also convert the same into Equivalents
cm = 1000;
# Converting centimeter
# into meter and kilometer
meter = cm / 100.0;
kilometer = cm / 100000.0;
# Driver Code
print("Length in meter = " ,
meter , "m");
print("Length in Kilometer = ",
kilometer , "km");
DEPARTMENT OF
3. Screenshot of Outputs:
(a)
(b)
( c)
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING