Ways to make change

Write change_ways(amount, coins) that returns how many different combinations of the given coin denominations add up to amount. Order does not matter: 1+2 and 2+1 are the same combination. change_ways(0, coins) is 1.

change_ways(5, [1, 2, 5])  ->  4     (5, 2+2+1, 2+1+1+1, 1+1+1+1+1)
change_ways(3, [2])        ->  0
change_ways(10, [10])      ->  1

The point is to practise the loop order that counts combinations rather than sequences: coins outside, amounts inside.

def change_ways(amount, coins):
    ...