Today, I was given an assignment to write a program to implement an atm dispenser in the following notes: 100, 50, 20, 10, and 5. If the amount is not a multiply of 5, the atm will return a list of 0.

In the code are short explanations of why I used it.

# asks the customer to enter an amount of number.
atm = int(input("Enter an amount in a multiple of 5: "))

# This takes in a amount parameter which is the input  from the user and return an array of bills in the following orders: [$100, $50, $20, $10, $5]. 
def dispenser(amount):
    
    # if statement to check if number entered is divisible by 5. If not, return with 0, if yes, continue code.
    if atm % 5 != 0:
        return [0, 0, 0, 0, 0]
    
    result = []
    bill_types = [100, 50, 20, 10, 5]

# starts with the starting amount being divided by each number in bill_types.
    for each_note in bill_types:
        note_counts = amount // each_note
        result.append(note_counts)

        # get the remainder and overwrite the previous.
        amount = amount % each_note

    return result

# The code below is what will be given back as a sentence to the customer.
print(f"You entered ${atm}: {dispenser(atm)}")