14/28
Part 4 of 7 · Count the waysLearn and do

Coins outside: each pass lets in one more coin

Print the list after each coin's pass:

coins, ways = [1, 3, 4], [1] + [0] * 6
print(f"{'no coins':<17}{ways}")
for i, v in enumerate(coins):
    for t in range(v, 7):
        ways[t] += ways[t - v]
    print(f"{'coins ' + str(coins[:i + 1]):<17}{ways}")
Predict

After the 3-cent pass, what is ways[6]?

Pick one to see what it prints.
Pick an answer above to see the rest