for e in set([l[-1] for l in num_list]):
print([e, sum([l[0] for l in num_list if l[1] == e])])
def get_iter(num_list):
for e in set([l[-1] for l in num_list]):
yield [sum([l[0] for l in num_list if l[1] == e]), e]
for e in get_iter(num_list):
print(e)