Ask Your Question

Revision history [back]

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))