Initial commit

This commit is contained in:
Kevin Keogh
2018-07-02 15:45:49 -04:00
parent 60b3954a3b
commit fd817f8811
28 changed files with 809 additions and 0 deletions

38
problem-31.py Normal file
View File

@@ -0,0 +1,38 @@
import itertools
pence = list(range(201))
two_pence = list(range(101))
five_pence = list(range(41))
ten_pence = list(range(21))
twenty_pence = list(range(11))
fifty_pence = list(range(5))
pound = [0, 1, 2]
two_pound = [0, 1]
results = []
combos = itertools.product(
pence,
two_pence,
five_pence,
ten_pence,
twenty_pence,
fifty_pence,
pound,
# two_pound
)
for combo in combos:
if combo[0] \
+ combo[1] * 2 \
+ combo[2] * 5 \
+ combo[3] * 10 \
+ combo[4] * 20 \
+ combo[5] * 50 \
+ combo[6] * 100 == 200:
results.append(combo)
results.append((0, 0, 0, 0, 0, 0)) # representing 1 pound coin
print(results)
print(len(results))