MCPcopy Create free account
hub / github.com/Vishruth-S/CompetitiveCode / libraryFine

Function libraryFine

Hackerrank_problems/Library Fine/solution.py:10–24  ·  view source on GitHub ↗
(d1, m1, y1, d2, m2, y2)

Source from the content-addressed store, hash-verified

8
9# Complete the libraryFine function below.
10def libraryFine(d1, m1, y1, d2, m2, y2):
11 if y1<=y2: # checking whether the returned year is less than equal to the due year
12 if y1<y2:
13 fine =0
14 else: # when both the years are equal
15 if ((m1==m2) and (d1<=d2)) or (m1<m2): # check for due month and returned month is same but the returned date is less than the due date, or due month is more than the returned month
16 fine=0
17 else: # check for when the returned date is past the due date
18 if (d1>d2) and (m1==m2): # month is same but the returned date is more
19 fine = 15*(d1-d2)
20 else: # returned month is more than the due month
21 fine = 500*(m1-m2)
22 else: # returned year is more than the due year
23 fine=10000
24 return fine
25
26
27

Callers 1

solution.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected