Loop two iterators with the zip function - Deepstash

Loop two iterators with the zip function

I love the zip function and it has saved me countless (nested) loops. I use it mostly for iterating over two data types at the same time, where I need the indexes to be equal.

You can do this with any data type or generator. For instance, you could create dictionaries without looping over the separate lists, as such:

Later on, we’ll introduce the *args operator, which in combination with the zip function is very powerful!

2

18 reads

CURATED FROM

IDEAS CURATED BY

The idea is part of this collection:

Machine Learning With Google

Learn more about computerscience with this collection

Understanding machine learning models

Improving data analysis and decision-making

How Google uses logic in machine learning

Related collections

Read & Learn

20x Faster

without
deepstash

with
deepstash

with

deepstash

Personalized microlearning

100+ Learning Journeys

Access to 200,000+ ideas

Access to the mobile app

Unlimited idea saving

Unlimited history

Unlimited listening to ideas

Downloading & offline access

Supercharge your mind with one idea per day

Enter your email and spend 1 minute every day to learn something new.

Email

I agree to receive email updates