Robotics & Artificial Intelligence
A library charges fine according to the number of days a book returned late, according to the following criteria.
| Days | Fine per day |
|---|---|
| First 10 days | Rs. 1 |
| Next 10 days | Rs. 2.5 |
| Beyond 20 days | Rs.5 |
Write a program to enter the number of days a book was returned late and print the fine to be paid.
Python Control Flow
1 Like
Answer
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)Output
Enter number of days late: 25
Fine to be paid: 60.0
Answered By
1 Like
Related Questions
Define the role of sensors in robotics. Differentiate between internal and external sensors with examples.
List three ethical issues related to cybersecurity.
Explain the use of Tinkercad in designing robotic components. What are the advantages of visualising motion using Tinkercad?
Explain how the phenomenon of hacking can lead to data theft and what measures can be implemented to prevent it.