AI engineering glossary · Python core

What is zip?

zip: A built-in function that combines several iterables element by element, yielding tuples of matching positions and stopping at the shortest input. It is used to loop over parallel lists or build dictionaries from keys and values.

Level: intermediateTopic: Python core

zip: an example

list(zip([1, 2, 3], ['a', 'b'])) gives [(1, 'a'), (2, 'b')], and dict(zip(keys, values)) builds a dictionary.

Related terms

More Python core terms

Where you learn it

zip is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.