Python enumerate() Function
The enumerate() function takes a collection (e.g. a tuple) and
returns it as an enumerate object.
The enumerate object yields pairs containing a count (from start, which defaults to 0) and a value yielded by the iterable argument.
Syntax
enumerate(iterable, start=0)
Parameters
| Parameter | Description |
|---|---|
iterable |
Required. An iterable object (list, tuple, etc.) |
start |
Optional. Integer check start number. Default is 0 |
Return Value
An enumerate object.
Example
Using the enumerate() function:
Output
Click Run to execute your code
Enjoying these tutorials?