Define a function pay_with_coins( amount ), where amount
is a floating point number with up to two decimal places, and the result retuned
by the function is a list of integers giving the number of each UK coin required to pay the
given amount with the minimum number of coins.
Specifically, the list returned should always contain 8 elements, which should be the number of coins of each type required, given in the following order.
| Examples | ||
|---|---|---|
| INPUT | OUPUT | Coins to be paid* |
| 0.08 | [0,0,0,0,0,1,1,1] | 1×5p, 1×2p, 1×1p |
| 8.02 | [4,0,0,0,0,0,1,0] | 4×£2, 1×2p |
| 1.74 | [0,1,1,1,0,0,2,0] | 1×£1, 1×50p, 1×20p, 2×2p |
| 1001 | [500,1,0,0,0,0,0,0] | 500×£2, 1×£1 |
| *This is just an explanation of what the output means. | ||