Sample Output
Sample Output
1. Write a program in Python to accept First Name and Last Name from the user. Display "Good Day"
wish combined with the First Name and Last Name.
Sample output:
Enter First Name: Aradhya
Enter Last Name: Sengupta
Good Day Aradhya Sengupta
# --------------------------------------------------------------#
# List-Program No : L1-P1
# Developed By : Suhani Mishra and Sonakshi Agrawal
# Date : 22-April-2024 #
# --------------------------------------------------------------#
2. Write a program in python to accept Length (in inches of type float) and Breadth (in inches of
type float) of a Rectangle.
Find and display (a) Area of the rectangle and (b) Perimeter of the rectangle.
# --------------------------------------------------------------#
# List-Program No : L1-P2
# Developed By : Suhani Mishra and Sonakshi Agrawal
# Date : 22-April-2024 #
# --------------------------------------------------------------#
# --------------------------------------------------------------#
# List-Program No : L1-P3
# Developed By : Suhani Mishra and Sonakshi Agrawal
# Date : 22-April-2024 #
# --------------------------------------------------------------#
degree=int(input("Enter degree:"))
print("In Radians:",degree/57.3)
4. Write a Python program to convert radians to degrees.
Sample Output:
Input radians: 2
In Degree : 114.54545454545455
# --------------------------------------------------------------#
# List-Program No : L1-P4
# Developed By : Suhani Mishra and Sonakshi Agrawal
# Date : 22-April-2024 #
# --------------------------------------------------------------#
radian=float(input("Enter radian:"))
print("In Degree:",radian*57.3)
# --------------------------------------------------------------#
# List-Program No : L1-P5
# Developed By : Suhani Mishra and Sonakshi Agrawal
# Date : 22-April-2024 #
# --------------------------------------------------------------#
# --------------------------------------------------------------#
# List-Program No : L1-P6
# Developed By : Suhani Mishra and Sonakshi Agrawal
# Date : 22-April-2024 #
# --------------------------------------------------------------#
7. Write a Python program to calculate volume (πr2h) and surface area (2πrh+2πr2 ) of a Cylindrical
Oil Container.
Also
(i) Calculate the price of painting this Cylindrical Oil Container, if the price for painting is Rs.
530 per square meter.
(ii) Maximum cost of Petrol, that can be stored in the cylindrical container, if the price of
petrol is Rs. 73 per litre . [Remember 1 mtr cube = 1000 litre]
Sample Output:
Height [in meters]: 5
Radius [in meters]: 3
Volume : 141.42857142857142 [meter cube]
Volume [Rounded to Decimals]: 141.43
Surface Area is: 150.85714285714286 [mtr sq]
Surface Area [Rounded to 2 Decimals]:150.86
Painting Charges [Rs.]: 79955.8
Cost of Petrol [Rs.]: 10324390.0
# --------------------------------------------------------------#
# List-Program No : L1-P7
# Developed By : Suhani Mishra and Sonakshi Agrawal
# Date : 22-April-2024 #
# --------------------------------------------------------------#
h=int(input("Height[in m]"))
r=int(input("Radius[in m]"))
V=float(3.14*(r**2)*h)
S=float((2*3.14*r*h)+2*3.14*(r**2))
8. Write a Python program to calculate volume and area of a sphere. (Area= 4 π r2),
(Volume= 4/3πr3)
Sample Output:
Radius of sphere: 5
Surface Area: 314.2857142857143
Volume : 523.8095238095237
# --------------------------------------------------------------#
# List-Program No : L1-P8
# Developed By : Suhani Mishra and Sonakshi Agrawal
# Date : 22-April-2024 #
# --------------------------------------------------------------#
r=int(input("Radius of sphere:"))
s=float(4*3.14*r**2)
v=float(4/3*3.14*r**3)
print("Surface Area", s)
print("Volume:", v)
9. Write a program in to accept Qty of Fuel (in Litre) and Distance traveled (in KM) from the user,
calculate and display the Average of the Vehicle (i.e. KM per Liter).
# --------------------------------------------------------------#
# List-Program No : L1-P9
# Developed By : Suhani Mishra and Sonakshi Agrawal
# Date : 22-April-2024
# --------------------------------------------------------------#
10. Write a program in to accept Marks of 5 subjects (each out of 100), calculate and display
(a) Total Marks obtained (b) Average Marks
# --------------------------------------------------------------#
# List-Program No : L1-P10
# Developed By : Suhani Mishra and Sonakshi Agrawal
# Date : 22-April-2024
# --------------------------------------------------------------#
11. Write a program to allocate and display Block and Floor No on the basis of Customer Number.
Assuming there are 10 Blocks (‘A’ to ‘J’) with 5 floors (0 to 4) each and allocated to customers
sequentially as per their Customer Number. For example: Customer no 1 gets [Block A Floor 0],
Customer no 3 gets [Block A Floor 2], Customer no 7 gets [Block B Floor 1]
Note: This program has to be done only using arithmetic operations and type conversions
(i.e., with out use of if-else)
Hint: ASCII codes for ‘A’,’B’.. are 65,66,... & chr(65) in python is ‘A’
# --------------------------------------------------------------#
# List-Program No : L1-P11
# Developed By : Suhani Mishra and Sonakshi Agrawal
# Date : 22-April-2024
# --------------------------------------------------------------#
12. Write a program to calculate total collection of a PARKING area on the basis of the number of
vehicles under each category entered by the user. Per vehicle amounts for each type of vehicle is
as follows: Bus Rs. 100 SUVRs.40 CAR Rs.30 Two-Wheeler Rs.10
Sample Output:
Number of Buses : 10
Number of SUVs : 20
Number of Cars : 45
Number of Two-Wheelers : 120
Collection for Buses : 1000
Collection for SUVs : 800
# --------------------------------------------------------------#
# List-Program No : L1-P12
# Developed By : Suhani Mishra and Sonakshi Agrawal
# Date : 22-April-2024
# --------------------------------------------------------------#
b=int(input("Number of buses:"))
s=int(input("Number of SUVs:"))
c=int(input("Number of Cars:"))
t=int(input("Number of Two-Wheelers:"))
cb=b*100
cs=s*40
cc=c*30
ct=t*10
print(cb)
print(cs)
print(cc)
print(ct)
print("Total collection:",cb+cs+cc+ct)
13. Write a program to accept Basic Salary (Basic) of employee from user and calculate the following:
(a) Dearness Allowance (DA) as 30% of Basic
(b) House Rent Allowance (HRA) as 25% of Basic
(c) Income Tax (IT) as 10% of Basic if Basic<50000 and 20% of Basic if Basic>=50000
(d) Total Salary (TSAL) as BASIC+DA+HRA
(e) Salary in hand (SALH) as TSAL-IT
# --------------------------------------------------------------#
# List-Program No : L1-P13
# Developed By : Suhani Mishra and Sonakshi Agrawal
# Date : 22-April-2024
# --------------------------------------------------------------#
tsal=basic+da+hra
print("Total salary:",tsal)
salh=tsal-it*basic
print("Salary in hand:",salh)
14. Write a program to accept marks of English (ENG), marks of Maths (MAT), marks of Science (SCI)
each out of 100, calculate and display the following:
(a) Total Marks (TOT) as ENG+MAT+SCI
(b) Percentage of Marks (PER) as TOT/3
(c) Display Grade as ‘A’ if PER>50 ‘B’ if PER>0 and ‘C’ if PER=0
[without using if_else command]
# --------------------------------------------------------------#
# List-Program No : L1-P14
# Developed By : Suhani Mishra and Sonakshi Agrawal
# Date : 22-April-2024
# --------------------------------------------------------------#
15. Write a program to accept the age of the individual and display a message "Allowed to get a
license to Drive" if Age entered by the user >=18 else display a message "Wait for x years to get a
Driving License". Here, x to be replaced with 18-Age years.
# --------------------------------------------------------------#
# List-Program No : L1-P15
16. Write a program to accept the grade of a student out of ‘A’ to ‘F’ from the user and display the
range of marks on the screen as per the following table using if else.
Grade Marks Range
A 100-90
B 89-75
C 74-60
D 59-45
E 44-33
F 32-0
# --------------------------------------------------------------#
# List-Program No : L1-P16
# Developed By : Suhani Mishra and Sonakshi Agrawal
# Date : 22-April-2024
# --------------------------------------------------------------#
17. Write a program to accept marks of a student out of 100, find and display Grades ‘A’ to ‘F’ as per
the following grade table using if else.
Marks Range Grade
100 -90 A
89.9-75 B
74.9-60 C
59.9-45 D
44.9-33 E
32.9-0 F
# --------------------------------------------------------------#
# List-Program No : L1-P17
# Developed By : Suhani Mishra and Sonakshi Agrawal
# Date : 22-April-2024
# --------------------------------------------------------------#
18. Writea program to make a calculator application with the following operations:
(a) Accept values of two real numbers
(b) Accept arithmetic operation to be performed out of ‘+’,‘-’,‘*’,‘/’,‘%’
(c) Perform the desired arithmetic operation on two real number and display the result of
operation as selected by the user
# --------------------------------------------------------------#
# List-Program No : L1-P18
# Developed By : Suhani Mishra and Sonakshi Agrawal
# Date : 22-April-2024
# --------------------------------------------------------------#
n1=int(input("Enter no."))
n2=int(input("Enter no."))
o=input("Enter arithmetic operator")
if o=="+":
print(n1+n2)
elif o=="-":
print(n1-n2)
elif o=="/":
print(n1/n2)
elif o=="*":
print(n1*n2)
elif o=="%":
print(n1%n2)
19. Write a program to display the Floor for the various items in a SHOPPING MALL on the basis of Age
and Gender entered by user as per the following table:
Age Gender Floor
>=60 M 7
>=20 and <60 M 6
>=10 and <20 M 5
<10 M 4
>=58 F 3
>=18 and <58 F 2
>=10 and <18 F 1
<10 F 0
Sample Output 1:
Age : 45
Gender : F
Floor : 2
Sample Output 2:
Age : 18
Gender : M
Floor : 5
# --------------------------------------------------------------#
# List-Program No : L1-P19
# Developed By : Suhani Mishra and Sonakshi Agrawal
# Date : 22-April-2024
# --------------------------------------------------------------#
age=int(input("Enter Age"))
gen=input("Enter gender (F/M)")
if age>=60 and gen=="M":
print("Floor 7")
elif 60>age>=20 and gen=="M":
print("Floor 6")
elif 20>age>=10 and gen=="M":
print("Floor 5")
elif age<10 and gen=="M":
print("Floor 4")
elif age>=58 and gen=="F":
print("Floor 3")
elif 58>age>=18 and gen=="F":
print("Floor 2")
elif 18>age>=10 and gen=="F":
20. Write a program to accept runs of three consecutive cricket matches, find and display the highest
and lowest runs.
Sample Output:
Match 1 Runs: 320
Match 2 Runs: 210
Match 3 Runs: 275
Highest Runs: 320 Lowest Runs : 210
# --------------------------------------------------------------#
# List-Program No : L1-P20
# Developed By : Suhani Mishra and Sonakshi Agrawal
# Date : 22-April-2024
# --------------------------------------------------------------#
21. Write a program to display the BLOCK of buildings in school allocated for a particular group of
students as per their class and stream entered by the user.
Class Stream Block
11 'S' F Block
11 'C' E Block
11 'H' D Block
12 'S' C Block
12 'C' B Block
12 'H' A Block
Sample Output:
Enter Class : 11
Enter Stream : H
Block : D Block
# --------------------------------------------------------------#
# List-Program No : L1-P21
# Developed By : Suhani Mishra and Sonakshi Agrawal
# Date : 22-April-2024
# --------------------------------------------------------------#
c=int(input("Enter class:"))
s=str(input("Enter stream:"))
if c==11 and s=="S":
print("F block")
elif c==11 and s=="C":
print("E block")
elif c==11 and s=="H":
print("D block")
elif c==12 and s=="S":
print("C block")
elif c==12 and s=="C":
print("B block")
elif c==12 and s=="H":
print("A block")
General Instructions:
i. Type the solutions of all the problems using Python Language on Python IDLE or
colab.research.google.com
ii. Type in the following on top of each of your program as comment lines
# --------------------------------------------------------------#
# List-Program No : L1-P1
# Developed By : Jhilmil Roy
# Date : 22-April-2024
# --------------------------------------------------------------#
iii. On successful execution with meaningful data, copy and paste the sample output at the bottom
of the program as comment lines.
iv. “Turn in” the softcopy of the programs as a single document in response to this assignment
submission with each program on separate pages. Once verified by the teacher, take out a
hardcopy of each program on separate pages from the printer and get them signed by the
respective computer teacher. Add all the printouts in the practical file and get the Index entry
also signed.
v. Recommended Font, “Courier New”, Style “Bold” Size “10” for all programs with single line
spacing. Default indentation 2 Character only.