28. Zip Function in Python Example || Mapping Elements Python Programming Tutorial

Published: 05 July 2022
on channel: Ram Case
5
0

The zip() function returns an iterator of tuples based on the iterable objects. If a single iterable is passed, zip() returns an iterator of tuples with each tuple having only one element. If multiple iterables are passed, zip() returns an iterator of tuples with each tuple having elements from all the iterables.

Code:
names=('Kevin','Peter','Thomas','Tom','Peter')
comps=('Dell','Apple','Sony','Microsoft','Apple')


zipped=list(zip(names,comps))
print(zipped,'\n')

zipped=set(zip(names,comps))
print(zipped,'\n')

zipped=zip(names,comps)
for (a,b) in zipped:
print(a,b,'\n')


On this page of the site you can watch the video online 28. Zip Function in Python Example || Mapping Elements Python Programming Tutorial with a duration of hours minute second in good quality, which was uploaded by the user Ram Case 05 July 2022, share the link with friends and acquaintances, this video has already been watched 5 times on youtube and it was liked by 0 viewers. Enjoy your viewing!