Python Day 26: Nested Logic
Your local library needs your help! Given the expected and actual return dates for a library book, create a program that calculates the fine (if any). The fee structure is as follows:
If the book is returned on or before the expected return date, no fine will be charged (i.e. fine=0) .
If the book is returned after the expected return day but still within the same calendar month and year as the expected return date, fine= 15 Hackos x number of days late.
If the book is returned after the expected return month but still within the same calendar year as the expected return date, the fine= 500Hackos x number of days late.
If the book is returned after the calendar year in which it was expected, there is a fixed fine of 10000 Hackos
- returned_date = list(map(int,input().split(' ')))
- expected_date = list(map(int,input().split(' ')))
-
- fine = 0
-
- if returned_date[2] > expected_date[2]:
- fine = 10000
- elif returned_date[2] == expected_date[2]:
- if returned_date[1] > expected_date[1]:
- fine = (returned_date[1] - expected_date[1])*500
- elif returned_date[1] == expected_date[1]:
- if returned_date[0] > expected_date[0]:
- fine = (returned_date[0] - expected_date[0])*15
-
- print(fine)