Python Programs - Basic Practice
1. Area of Rectangle
l = int(input("Enter length: "))
b = int(input("Enter breadth: "))
area = l * b
print("Area of rectangle:", area)
2. Area of Circle
r = int(input("Enter radius: "))
area = 3.14 * r * r
print("Area of circle:", area)
3. Total and Percentage of 5 Subjects
name = input("Enter student name: ")
n1 = int(input("Enter marks of subject 1: "))
n2 = int(input("Enter marks of subject 2: "))
n3 = int(input("Enter marks of subject 3: "))
n4 = int(input("Enter marks of subject 4: "))
n5 = int(input("Enter marks of subject 5: "))
total = n1 + n2 + n3 + n4 + n5
percentage = total / 5
print("Total marks:", total)
print("Percentage:", percentage)
4. Feet to Inches Conversion
feet = int(input("Enter distance in feet: "))
inches = feet * 12
print("Distance in inches:", inches)
5. Fahrenheit to Celsius Conversion
f = int(input("Enter temperature in Fahrenheit: "))
c = (f - 32) * 5 / 9
print("Temperature in Celsius:", c)
6. Volume of Cylinder
r = int(input("Enter radius of cylinder: "))
h = int(input("Enter height of cylinder: "))
volume = 3.14 * r * r * h
print("Volume of cylinder:", volume)