Home >>Python Built-in Functions >Python enumerate() Function
Python enumerate() function is used to takes a collection and return it as an enumerate object. It adds a counter as the key of the enumerate object.
Syntax:enumerate(iterable, start)
Parameter | Description |
---|---|
iterable | This parameter holds an iterable object. |
start | This parameter defines the start number of the enumerate object. |
x = ('apple', 'banana', 'mango', 'orange')
y = enumerate(x)
print(list(y))
x = (1, 2, 3, 4, 5, 6)
y = enumerate(x)
print(list(y))