PRACTICAL PROGRAMS – CLASS 9
Q.1 Write a program to calculate simple interest by given user input
principal, rate and time..
P=int(input(“Please Enter the Principal Amount”))
R=int(input(“Please Enter the Rate”))
T= int(input(“Please Enter the Time”))
SI= (P*R*T)/100
print (“Simple interest is = ”, SI)
Q.2 Write a program to convert length given in kilometers into meters.
# Program to convert kilometers to meters
# Input: Length in kilometers
kilometers = float(input("Enter length in kilometers: "))
# Conversion factor
meters = kilometers * 1000
# Output: Length in meters
print(kilometers, "kilometers is equal to", meters, "meters")
Q.3 Write a program to calculate the Volume and Surface Area of Cuboid
# Python Program to Calculate the Volume and Surface Area of Cuboid
# Take the input from the User
length = float(input("Enter the Length of a Cuboid: "))
width = float(input("Enter the Width of a Cuboid: "))
height = float(input("Enter the Height of a Cuboid: "))
# Calculate the Surface Area
SA = 2 * (length * width + length * height + width * height)
# Calculate the Volume
Volume = length * width * height
# Print the Output
print("\nThe Surface Area of a Cuboid = " , SA)
print("The Volume of a Cuboid = " ,Volume);
Q.4 Write a program to print first 10 even numbers.
Using for loop
print("First 10 even numbers:")
for i in range(1, 11):
print(i * 2)
Using while loop
print("First 10 even numbers:")
count = 0
num = 2
while count < 10:
print(num)
num += 2
count += 1
Q.5 Write a program to calculate the electricity bill (accept number of units
from user) according to the following criteria:
amt = 0
nu = int(input("Enter the number of electric unit"))
if nu<=100:
amt = 0
elif nu>100 and nu<=200:
amt = (nu-100)*5
else:
amt = 500 + (nu-200)*10
print("Amount is",amt)