The zip method lets us map the corresponding index of multiple containers so that we can use them using as a single unit.
Syntax:
zip(*iterables)
Example:
# Example: zip() function
emp = [ "tom", "john"]
age = [ 32, 28]
dept = [ 'HR', 'Accounts']
# call zip() to map values
out = zip(emp, age, dept)
# convert all values for printing them as set
out = set(out)
# Displaying the final values
print ("The output of zip() is : ",end="")
print (out)
Output:
{('tom', 32, 'HR'), ('john', 28, 'Accounts')}
For other top rated Codersarts python program links
For given latitude value check the location on equator in python
Calculate distance between two points on Earth the latitute and longitude given in degrees
Write a program of Rational Numbers Addition,Subtraction, Multiplication, Division in python
Design and implement a "Golf Club" program that records information about golfers and tournaments
Concatenate First, mid and last character of String in Python
A set of utilities to manipulate polynomials, Addition, subtraction, Multiplication and evaluation
For other top rated python program visit here
If you like Codersarts blog and looking for Assignment help,Project help, Programming tutors help and suggestion you can send mail at contact@codersarts.com.
Please write your suggestion in comment section below if you find anything incorrect in this blog post