Python Worksheet - Class VI
Q1.
Write a program in Python to input the price of one burger and the number of burgers eaten
by a group of friends. Print the total amount to be paid by the group.
price = float(input("Enter price of one burger: "))
quantity = int(input("Enter number of burgers: "))
total = price * quantity
print("Total amount to be paid:", total)
Q2.
Write a Python program to input the base and height of a triangle, and calculate and print its
area using the formula:
Area = 1/2 × base × height
base = float(input("Enter base of the triangle: "))
height = float(input("Enter height of the triangle: "))
area = 0.5 * base * height
print("Area of triangle:", area)
Q3.
Write a program in Python to calculate and print the circumference and area of a circle with
radius 21 cm. Use π = 3.14.
radius = 21
pi = 3.14
area = pi * radius * radius
circumference = 2 * pi * radius
print("Area of circle:", area)
print("Circumference of circle:", circumference)
Q4.
Write a Python program to assign the name and price of any book in appropriate variables
and print both with proper messages.
book_name = input("Enter the name of the book: ")
book_price = float(input("Enter the price of the book: "))
print("Book Name:", book_name)
print("Book Price: Rs", book_price)
Q5.
200 litres of milk is to be stored in cans of capacity 5 litres each. Write a Python program to
calculate and print the number of cans required.
milk = 200
can_capacity = 5
cans_required = milk // can_capacity
print("Cans required:", cans_required)
Q6.
Mohita spends the following on stationery after getting ₹500 from her parents:
- Register: ₹210
- Pen: ₹50
- Pencil: ₹12
- Eraser: ₹8
- Stapler: ₹68
Write a Python program to print total expenditure and amount left.
total = 210 + 50 + 12 + 8 + 68
money_given = 500
balance = money_given - total
print("Total expenditure:", total)
print("Amount left:", balance)
Q7.
An aeroplane takes 5 hours and 38 minutes to travel. Write a Python program to calculate
total time in minutes.
hours = 5
minutes = 38
total_minutes = (hours * 60) + minutes
print("Total time in minutes:", total_minutes)
Q8.
A child reads 63 pages in a week. Write a Python program to calculate number of pages read
per day.
total_pages = 63
days = 7
pages_per_day = total_pages // days
print("Pages read per day:", pages_per_day)
Q9.
Write the Python expression for the formula:
a² + b²
(a * a) + (b * b)