lst1 = ['a', 'b', 'c']
lst2 = ['1', '2']
def comb(lst1, lst2):
for i in lst1:
new_list = []
for j in lst2:
new_list.append(i + '_' + j)
return new_list
print(comb(lst1, lst2))
Gives me:
['c_1', 'c_2']
I am hoping to get:
['a_1', 'a_2']
['b_1', 'b_2']
['c_1', 'c_2']
Could someone please point out the mistake in my code? Thanks!