1.
Write a python program to calculate the area and
perimeter of a rectangle
length = float(input("Enter the length of the rectangle: "))
width = float(input("Enter the width of the rectangle: "))
area = length * width
perimeter = 2 * (length + width)
print("Area of the rectangle:", area)
print("Perimeter of the rectangle:", perimeter)
[Link] a python program to calculate the area of a triangle
with base and height
base = float(input("Enter the base of the triangle: "))
height = float(input("Enter the height of the triangle: "))
area = 0.5 * base * height
print("Area of the triangle:", area)
[Link] a python program to calculate the 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: "))
average = (m1 + m2 + m3) / 3
print("Average marks:", average)
4. Write a python program to calculate the 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 of cuboid:", surface_area)
print("Volume of cuboid:", volume)
5. Write a python program to check if a person can vote
age = int(input("Enter your age: "))
if age >= 18:
print("You are eligible to vote.")
else:
print("You are not eligible to vote.")
6. Write a python program to check the grade of a student
marks = int(input("Enter marks: "))
if marks >= 90:
print("Grade: A")
elif marks >= 75:
print("Grade: B")
elif marks >= 50:
print("Grade: C")
else:
print("Grade: Fail")
7. Write a python program to input a number and check if
the number is positive, negative, or zero and display an
appropriate message
num = int(input("Enter a number: "))
if num > 0:
print("The number is positive.")
elif num < 0:
print("The number is negative.")
else:
print("The number is zero.")
8. Write a python program to print the first 10 odd numbers
for i in range(1, 20, 2):
print(i)
9. Write a python program to create a list
num=[23,12,5,9,65,44]
A. Print the length of the list
B. Print the elements from second to fourth position using
positive indexing.
C. Print the elements from position 3 to position 5 using
negative indexing
num = [23, 12, 5, 9, 65, 44]
print("Length of the list:", len(num))
print("Elements (2nd to 4th):", num[1:4])
print("Elements (3rd to 5th using negative indexing):", num[-4:-
1])
[Link] a python program to calculate simple interest
principal = float(input("Enter the principal amount: "))
rate = float(input("Enter the rate of interest: "))
time = float(input("Enter the time (in years): "))
simple_interest = (principal * rate * time) / 100
print("Simple Interest:", simple_interest)