10 PYTHON PROGRAMS
1)- Sum of Three Numbers
# Program to find sum of three numbers
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
c = int(input("Enter third number: "))
sum = a + b + c
print("Sum of three numbers =", sum)
2)- Area of a Rectangle
# Program to find area of a rectangle
length = float(input("Enter length: "))
breadth = float(input("Enter breadth: "))
area = length * breadth
print("Area of rectangle =", area)
3)- Cube of a Number
# Program to find cube of a number
num = int(input("Enter a number: "))
cube = num ** 3
print(“Cube is", cube)
4)- Enter and Print a Poem
# Program to enter a small poem and print it
poem = input("Enter your poem: ")
print("Your poem is:", poem)
5)- Simple Interest
# Program to find simple interest
p = float(input("Enter Principal: "))
r = float(input("Enter Rate of Interest: "))
t = float(input("Enter Time (in years): "))
si = (p * r * t) / 100
print("Simple Interest =", si)
6)- Area and Perimeter of Rectangle
# Program to find area and perimeter of rectangle
l = float(input("Enter length: "))
b = float(input("Enter breadth: "))
area = l * b
perimeter = 2 * (l + b)
print("Area =", area)
print("Perimeter =", perimeter)
7)- Area of Triangle (Base & Height)
# Program to find area of a triangle
base = float(input("Enter base: "))
height = float(input("Enter height: "))
area = 0.5 * base * height
print("Area of triangle =", area)
8)- Average Marks of 3 Subjects
# Program to find average marks of 3 subjects
m1 = float(input("Enter marks of subject 1: "))
m2 = float(input("Enter marks of subject 2: "))
m3 = float(input("Enter marks of subject 3: "))
avg = (m1 + m2 + m3) / 3
print("Average marks =", avg)
9)- Discounted Amount
# Program to calculate discounted amount
price = float(input("Enter original price: "))
discount = float(input("Enter discount %: "))
discount_amount = (price * discount) / 100
final_price = price - discount_amount
print("Discounted amount =", final_price)
10)- Surface Area and Volume of Cuboid
# Program to find surface area and volume of a cuboid
l = float(input("Enter length: "))
b = float(input("Enter breadth: "))
h = float(input("Enter height: "))
surface_area = 2 * (l*b + b*h + l*h)
volume = l * b * h
print("Surface Area =", surface_area)
print("Volume =", volume)