First time here? Check out the FAQ!

Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

One may use enumerate and string formating:

for (i,t) in enumerate(test_comb, start=1):
    if (sum(t)==H):                 
        #Checking which combinations in  test_sum give the  sum = H and printing those
        print("({}) A combination is: {}\n".format(i, t))