1 2
import itertools
3
coin_names = {9: "blue coin", 2: "red coin", 3: "corroded coin", 5: "shiny coin", 7: "concave coin"}
4 5 6 7 8 9 10 11 12 13
coins = [9, 2, 3, 5, 7] combinations = itertools.permutations(coins,len(coins)) for elem in combinations: A = elem[0] B = elem[1] C = elem[2] D = elem[3] E = elem[4] if(A + B*pow(C,2) + pow(D,3) - E == 399):
14 15 16 17 18
print coin_names[A] print coin_names[B] print coin_names[C] print coin_names[D] print coin_names[E]