You are viewing a single comment's thread. Return to all comments →
import datetime def book_fee(due_date: datetime.date, return_date: datetime.date) -> int: if return_date < due_date: return 0 if (return_date.month, return_date.year) == (due_date.month, due_date.year): return 15 * (return_date.day - due_date.day) if due_date.year == return_date.year: return 500 * (return_date.month - due_date.month) return 10000 return_date = datetime.date( **dict( zip(["day", "month", "year"], [int(_) for _ in input().split(" ")]) ) ) due_date = datetime.date( **dict( zip(["day", "month", "year"], [int(_) for _ in input().split(" ")]) ) ) print(book_fee(due_date, return_date))
Seems like cookies are disabled on this browser, please enable them to open this website
Day 26: Nested Logic
You are viewing a single comment's thread. Return to all comments →