Thursday, December 13, 2018

Python Ninja Bootcamp 35-Zip function

Learn Python like a Professional! Take You from 0 to Hero






In this Python lecture, we will learn about the Zip( ).

"Zip is the function that takes the sequences as a parameter and aggregates their elements on each pass. "

Python Zip function

Let's see the example

tuple(zip((1,2,3),(4,5,6)))
>> ((1,4),(2,5),(3,6))

We can also insert list along with tuple

tuple(zip((1,2,3),(4,5,6),[7,8,9]))
>>  ((1,4,7),(2,5,8),(3,6,9))


Now let's find the greatest number from zip pair.

for pair in zip((1,2,3),(0,5,4)):
    print(max(pair))
>>1
    5
    4


EDITS ARE WELCOMED!!

In the next Blog, we will discuss Enumerate  

https://sngurukuls247.blogspot.com/2018/12/python-ninja-bootcamp-36-enumerate.html

......................................................................................................................................

Follow the link below to access Free Python Lectures-
https://www.youtube.com/channel/UCENc9qI7_r8KMf6-_1R1xnw

Instagram-
https://www.instagram.com/python.india/

View the Jupyter Notebook for this lecture

Download the Jupyter Notebook for this lecture 



Feel free contact me on-
Email - sn.gurukul24.7uk@gmail.com

No comments:

Post a Comment