arrow-left

All pages
gitbookPowered by GitBook
1 of 2

Loading...

Loading...

Zip Function

Output:

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 lists
  
name = [ "Manjeet", "Nikhil", "Shambhavi", "Astha" ]
roll_no = [ 4, 1, 3, 2 ]
marks = [ 40, 50, 60, 70 ]
  
# using zip() to map values
mapped = zip(name, roll_no, marks)
  
# converting values to print as list
mapped = list(mapped)
  
# printing resultant values 
print ("The zipped result is : ",end="")
print (mapped)
  
print("\n")
  
# unzipping values
namz, roll_noz, marksz = zip(*mapped)
  
print ("The unzipped result: \n",end="")
  
# printing initial lists
print ("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)

Built In Functions

  • abs() functionarrow-up-right

  • bin() functionarrow-up-right

hashtag
Built-in Functions:

​

​‌

The Python interpreter has a number of functions and types built into it that are always available. They are listed here in alphabetical order.

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​​

​Content

​Title

​Title

Built-in Functions

​Title

​Title

​abs()arrow-up-right​

​delattr()arrow-up-right​

​hash()arrow-up-right​

​memoryview()arrow-up-right​

​set()arrow-up-right​

​all()arrow-up-right​

​dict()arrow-up-right​

​help()arrow-up-right​

​min()arrow-up-right​

id() functionarrow-up-right
map() functionarrow-up-right
zip() functionarrow-up-right
filter() functionarrow-up-right
reduce() functionarrow-up-right
sorted() functionarrow-up-right
enumerate() functionarrow-up-right
reversed() functionarrow-up-right
range() functionarrow-up-right
sum() functionarrow-up-right
max() functionarrow-up-right
min() functionarrow-up-right
eval() functionarrow-up-right
len() functionarrow-up-right
ord() functionarrow-up-right
chr() functionarrow-up-right
any() functionarrow-up-right
all() functionarrow-up-right
globals() functionarrow-up-right
locals() functionarrow-up-right
Built-in Functions — Python 3.9.7 documentationdocs.python.orgarrow-up-right

​​

setattr()arrow-up-right
any()arrow-up-right
dir()arrow-up-right
hex()arrow-up-right
next()arrow-up-right
slice()arrow-up-right
ascii()arrow-up-right
divmod()arrow-up-right
id()arrow-up-right
object()arrow-up-right
sorted()arrow-up-right
bin()arrow-up-right
enumerate()arrow-up-right
input()arrow-up-right
oct()arrow-up-right
staticmethod()arrow-up-right
bool()arrow-up-right
eval()arrow-up-right
int()arrow-up-right
open()arrow-up-right
str()arrow-up-right
breakpoint()arrow-up-right
exec()arrow-up-right
isinstance()arrow-up-right
ord()arrow-up-right
sum()arrow-up-right
bytearray()arrow-up-right
filter()arrow-up-right
issubclass()arrow-up-right
pow()arrow-up-right
super()arrow-up-right
bytes()arrow-up-right
float()arrow-up-right
iter()arrow-up-right
print()arrow-up-right
tuple()arrow-up-right
callable()arrow-up-right
format()arrow-up-right
len()arrow-up-right
property()arrow-up-right
type()arrow-up-right
chr()arrow-up-right
frozenset()arrow-up-right
list()arrow-up-right
range()arrow-up-right
vars()arrow-up-right
classmethod()arrow-up-right
getattr()arrow-up-right
locals()arrow-up-right
repr()arrow-up-right
zip()arrow-up-right
compile()arrow-up-right
globals()arrow-up-right
map()arrow-up-right
reversed()arrow-up-right
__import__()arrow-up-right
complex()arrow-up-right
hasattr()arrow-up-right
max()arrow-up-right
round()arrow-up-right