शंतनू wrote: > s = [sum(x) for x in matrix] > for q in sorted([(x,y) for x,y in enumerate(s)], > key=operator.itemgetter(1)): > print("Employee %d has worked %d hours" % (q[0], q[1])) A minor simplification: s = (sum(x) for x in matrix) for q in sorted(enumerate(s), key=operator.itemgetter(1)): print("Employee %d has worked %d hours" % q)