I\'m looking for the most efficient way to figure out a change amount (Quarters, dimes, nickels, and pennies) from a purchase amount. The purchase amount must be less than $1, a
This is probably pretty fast - just a few operations per denomination:
def change(amount): money = () for coin in [25,10,5,1] num = amount/coin money += (coin,) * num amount -= coin * num return money