def dollars_to_changes(dollars, dollar_vals):
    """Given a dollars amount (e.g. $8.74), and a list of dollar_values
    in descending values (e.g. [5, 1, 0.50, 0.25, 0.10, 0.05, 0.01]),
    return a list of tuples of changes.
    E.g. [(5, 1), (1, 3), (0.5, 1), (0.1, 2), (0.01, 4)]
    """
    cents = int(dollars * 100)
    res = []
    for value in dollar_vals:
        cval = int(value * 100)
        n, cents = divmod(cents, cval)
        if n != 0:
            res += [(value, n)]

    return res