enumerate()Easy Examples

Adds a counter to an iterable, yielding (index, value) pairs

Basic enumerate() usage

Simple demonstration of the enumerate() built-in function.

python
fruits = ["apple", "banana", "cherry"]
for i, fruit in enumerate(fruits):
    print(f"{i}: {fruit}")

enumerate() is a built-in function that adds a counter to an iterable, yielding (index, value) pairs.

enumerate() with different inputs

Calling enumerate() with various argument types.

python
# More enumerate() examples
print("enumerate() is a Python built-in function")
print(f"Type: {type(enumerate)}")

enumerate() accepts different types of arguments and produces corresponding results.

Want to try these examples interactively?

Open Easy Playground