The zip() function is used to pack the elements at the corresponding positions of the two lists into a tuple.
1. The number of elements in the two lists is the same:
A=[1,2,3,4]
B=['吕布',‘司空震’,‘蒙恬’,‘马超’]
for i in zip(A,B):
print(i)
2. The elements in the two lists are different: (the length of the return value is the same as the length of the list with fewer elements)
A=[1,2,3,4]
B=['吕布',‘司空震’,‘蒙恬’,‘马超’,‘凯’]
for i in zip(A,B):
print(i)