def min_notes(M):
""" Function to calculate and return the minimum number of notes required
for the amount M, given a list of denominations.
"""
denominations = [500, 50, 10, 1]
remainder = M
notes = 0
for denom in denominations:
notes = notes + (remainder // denom)
remainder = remainder % denom
return notes
# Display outcome of function call
print(min_notes(562))
Comments
Leave a comment