The zipped result is : {('Shambhavi', 3, 60), ('Astha', 2, 70),
('Manjeet', 4, 40), ('Nikhil', 1, 50)}
How to unzip?
Unzipping means converting the zipped values back to the individual self as they were. This is done with the help of “*” operator.
# Python code to demonstrate the working of # unzip# initializing listsname = [ "Manjeet","Nikhil","Shambhavi","Astha" ]roll_no = [ 4,1,3,2 ]marks = [ 40,50,60,70 ]# using zip() to map valuesmapped =zip(name, roll_no, marks)# converting values to print as listmapped =list(mapped)# printing resultant values print ("The zipped result is : ",end="")print (mapped)print("\n")# unzipping valuesnamz, roll_noz, marksz =zip(*mapped)print ("The unzipped result: \n",end="")# printing initial listsprint ("The name list is : ",end="")print (namz)print ("The roll_no list is : ",end="")print (roll_noz)print ("The marks list is : ",end="")print (marksz)