Python enumerate() Function

❮ Built-in Functions


Example

Convert a tuple into an enumerate object:

x = ('apple', 'banana', 'cherry')
y = enumerate(x)
Try it Yourself »

Definition and Usage

The enumerate() function takes a collection (e.g. a tuple) and returns it as an enumerate object.

The enumerate() function adds a counter as the key of the enumerate object.


Syntax

enumerate(iterable, start)

Parameter Values

Parameter Description
iterable An iterable object
start A Number. Defining the start number of the enumerate object. Default 0

❮ Built-in Functions

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.