PYTHON INTERMEDIATEChapter 6 · Comprehensions and data tools
Enumerate and zip
enumerate() yields index-value pairs during iteration. zip() pairs up elements from multiple lists in parallel.
Worked example
How it reads
- enumerate(names) yields index and value pairs
- zip(names, scores) pairs up elements from lists in parallel

Cloud tip: zip() stops pairing as soon as the shortest input list is exhausted.


