Suppose there are two lists:
['a', 'b', 'c'], ['d', 'e', 'f']
what I want is:
'ad','ae','af','bd','be','bf','cd','ce','cf'
first_list = ['a', 'b', 'c']
second_list = ['d', 'e', 'f']
combined_list = []
for i in first_list:
for j in second_list:
combined_list.append(i + j)
print(combined_list)
my question is if there are not only two lists, how to improve the code? for example,
first_list = ['a', 'b', 'c']
second_list = ['d', 'e', 'f']
third_list = ['g','h','q']
print ['adg','adh','adq','aeg','aeh',.......]
guys,are there any generalizable ways to show n lists..I mean what if there are more than three lists?