A library charges fine according to the number of days a book returned late, according to the following criteria.

ICSE Class 10 Robotics & AI PYQ · 2025 Specimen · Section B

5(iii)Written · 2025 · Section B · 2025 Specimen

A library charges fine according to the number of days a book returned late, according to the following criteria.

DaysFine per day
First 10 daysRs. 1
Next 10 daysRs. 2.5
Beyond 20 daysRs.5

Write a program to enter the number of days a book was returned late and print the fine to be paid.

Show SolutionHide Solution↓
days = int(input("Enter number of days late: "))
if days <= 10:
    fine = days * 1
elif days <= 20:
    fine = 10 * 1 + (days - 10) * 2.5
else:
    fine = 10 * 1 + 10 * 2.5 + (days - 20) * 5
print("Fine to be paid:", fine)
Enter number of days late: 25
Fine to be paid: 60.0
← Previous questionNext question →

Browse the free Robotics & AI sample bank