• + 0 comments
    def libraryFine(d1, m1, y1, d2, m2, y2):
        # If the book is returned after the expected year
        if y1 > y2:
            return 10000
        # If the book is returned in the same year but after the expected month
        elif y1 == y2 and m1 > m2:
            return (m1 - m2) * 500
        # If the book is returned in the same year and month but after the expected day
        elif y1 == y2 and m1 == m2 and d1 > d2:
            return (d1 - d2) * 15
        # If the book is returned on or before the due date
        else:
            return 0