So if master list is: master_list = [“tom”, “bob”]
The new list should be: new_list = [‘tomtom”, “tombob”, “bobbob”, “bobtom”]
So if master list is: master_list = [“tom”, “bob”]
The new list should be: new_list = [‘tomtom”, “tombob”, “bobbob”, “bobtom”]
You can use itertools.product to generate the desired strings:
import itertools
master_list = ["tom", "bob"]
new_list = list(''.join(entry) for entry in itertools.product(master_list, repeat=2))
# Prints ['tomtom', 'tombob', 'bobtom', 'bobbob']
print(new_list)