Menu

Sign in to track your progress and unlock all features.

Theme style

Log in

Full lesson preview

Index and Value with Enumerate

Use enumerate to access both the index and value while iterating a sequence.

Python practice6 minLoops & IterationBeginnerLast updated March 15, 2026

Problem statement

Given a list, return a new list containing tuples where each tuple holds the index and the corresponding value from the input list. Use Python's enumerate to access both index and value while iterating.

Task

Learn to produce a list of (index, value) pairs from an input sequence using enumerate.

Examples

Basic example

Input

enumerate_pairs(['a', 'b', 'c'])

Output

[(0, 'a'), (1, 'b'), (2, 'c')]

Each element is paired with its index in a tuple.

Input format

A single list argument: enumerate_pairs(lst)

Output format

A list of tuples: [(index0, value0), (index1, value1), ...]

Constraints

- The input may be empty. - Elements may be of any type. - Preserve order and use zero-based indexing.

Samples

Sample 1

Input

enumerate_pairs([10, 20])

Output

[(0, 10), (1, 20)]

Two elements become two (index, value) tuples.