How to combine two lists element‑by‑element using zip in Python

1 Answer

0 votes
# two unequal-length lists
nums1 = [1, 2, 3, 4] 
nums2 = [10, 20, 30]

combine = list(zip(nums1, nums2)) 

print(combine)



'''
run:

[(1, 10), (2, 20), (3, 30)]

'''

 



answered Jan 19 by avibootz
edited Jan 19 by avibootz
...