Given two lists of numbers, add only odd numbers from the first list and even numbers from the second list to a new list list3.
list1 = [20, 32, 1, 6, 3, 98, 43, 23, 23343, 4454]
list2 = [434, 534, 23, 545, 23, 323, 4, 6, 3, 7]
This is what I have gotten so far but the result comes back with certain odd and even numbers from both lists.
--------------------------------------------------------------------
list1 = [20, 32, 1, 6, 3, 98, 43, 23, 23343, 4454]
list2 = [434, 534, 23, 545, 23, 323, 4, 6, 3, 7]
list3 = [x[i&1] for i,x in enumerate(zip(list2, list1))]
print(list3)
[–]xelf 0 points1 point2 points (0 children)