I wrote a simple change calculator in Python for practice, and I've run into a problem. Here's my code:
amounts = (100, 50, 20, 10, 5, 2, 1, 0.25, 0.10, 0.05, 0.01)
def get_change(full_amount): 
    final_change = []
    for amount in amounts:
        number = 0 
        while full_amount >= amount:
            if (full_amount < 0.50 and full_amount > 0.10 and amount == 0.25): break 
            number += 1
            full_amount -= amount
        final_change.append(number)
    return final_change
Let's say I enter 2.40. It goes from 2.40, to 0.40 (a toonie), and then it should go, do to if (full_amount < 0.50 and full_amount > 0.10 and amount == 0.25): break it will skip 0.25 and finish off with four dimes. However, in reality, it ends up with 3 dimes, one nickel, and only four pennies. The problem seems to arise when the remaining amount equals the amount being tested (0.10 cents remaining and 0.10 cents as the amount - and same with the nickel)
 
     
    