Dec-03-2018, 06:34 AM
(This post was last modified: Dec-03-2018, 06:34 AM by Gribouillis.)
The whole block of code from line 57 to 77 can now be replaced with
list_cnvrt.extend(list_tuple[int(number)] for number in list_numbers)and if you write
from itertools import product
at the top, the huge block of for statements near the end can be replaced withfor A, B, C, D, E, F, G in product(*list_cnvrt): print ("(",(cnt),") ",(A)+(B)+(C)+(D)+(E)+(F)+(G)) print("") cnt=cnt+1You could even write
for cnt, p in enumerate(product(*list_cnvrt), 1): print("({}) {}".format(cnt, sum(p)))