So I need to append two list together. Each element of the List one attached to each element of List two. So it the final list will be something like this: ['L1[0]L2[0]','L1[1]L2[1]','L1[2]L2[2]','L1[3]L2[3]']
. I keep running into the problem of putting a for loop inside another for loop but the result is having the first loop element repeat multiple times. I understand this isn't working, if any one can give me a nudge or somewhere to look into information on this sort of subject. As always thank you for the help!! Here is my code:
def listCombo(aList):
myList=['hello','what','good','lol','newb']
newList=[]
for a in alist:
for n in myList:
newList.append(a+n)
return newList
Example:
List1=['florida','texas','washington','alaska']
List2=['north','south','west','east']
result= ['floridanorth','texassouth','washingtonwest','','alaskaeast']