Is there any in build python iterating tool that reduces 3 row of for loops into one row? Here are the nested for loops that I want to reduce.
some_list = ["AB", "CD", "EF", "GH"]
for word_1 in some_list:
for word_2 in some_list:
for word_3 in some_list:
print(word_1, word_2, word_3) #Outputs all different combinations
I have tried the following but with no success:
some_list = ["AB", "CD", "EF", "GH"]
for word_1 ,word_2, word_3 in zip(some_list, some_list, some_list):
print(word_1 , word_2, word_3) #Outputs parallel elements, which is not what I want.