I have two lists:
odd_numbers = [1, 3, 5, 7]
evennumber = [2, 4, 6, 8]
I expect to print the below:
result = [1,2,3,4,5,6,7,8]
basically, picking up value from each list and concatenating them. I tried the below list comprehension that worked but i didn't understand the usage of for twice. Can some please explain:
y = [a for x in zip(odd_numbers, evennumber) for a in x]
print(y)
Also, if i wish to achieve the same output [1, 2, 3, 4, 5, 6, 7, 8], how can i do it with for loops?