A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.w3schools.com/python/ref_func_zip.asp below:

Website Navigation


Python zip() Function

Python zip() Function

❮ Built-in Functions

Example

Join two tuples together:

a = ("John", "Charles", "Mike")

b = ("Jenny", "Christy", "Monica")

x = zip(a, b)

Try it Yourself » Definition and Usage

The zip() function returns a zip object, which is an iterator of tuples where the first item in each passed iterator is paired together, and then the second item in each passed iterator are paired together etc.

If the passed iterables have different lengths, the iterable with the least items decides the length of the new iterator.

Syntax

zip(iterator1, iterator2, iterator3 ...)

Parameter Values Parameter Description iterable1, iterable2, iterable3 ... Iterable objects that will be joined together More Examples Example

If one tuple contains more items, these items are ignored:

a = ("John", "Charles", "Mike")

b = ("Jenny", "Christy", "Monica", "Vicky")

x = zip(a, b)

Try it Yourself »

❮ Built-in Functions

Track your progress - it's free!


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4