Try this:

[(i, j) for i, j in enumerate(mylist)]

You need to put i,j inside a tuple for the list comprehension to work. Alternatively, given that enumerate() already returns a tuple, you can return it directly without unpacking it first:

[pair for pair in enumerate(mylist)]

Either way, the result that gets returned is as expected:

> [(0, 'a'), (1, 'b'), (2, 'c'), (3, 'd')]
Answer from Óscar López on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › python › enumerate-in-python
Enumerate() in Python - GeeksforGeeks
Explanation: list(enumerate(a)) converts index-element pairs into a list of tuples.
Published: May 8, 2026
🌐
Real Python
realpython.com › python-enumerate
Python enumerate(): Simplify Loops That Need Counters – Real Python
October 21, 2025 - >>> values = ["first", "second"] >>> enumerate_instance = enumerate(values) >>> print(enumerate_instance) <enumerate at 0x7fe75d728180> >>> next(enumerate_instance) (0, 'first') >>> next(enumerate_instance) (1, 'second') >>> next(enumerate_instance) Traceback (most recent call last): File "<python-input-5>", line 1, in <module> next(enumerate_instance) ~~~~^^^^^^^^^^^^^^^ StopIteration · In this example, you create a Python list called values with two elements, "first" and "second".
Discussions

Python using enumerate inside list comprehension - Stack Overflow
Lets suppose I have a list like this: mylist = ["a","b","c","d"] To get the values printed along with their index I can use Python's enumerate function like this >>> for i,j in enumerate( More on stackoverflow.com
🌐 stackoverflow.com
What does enumerate do in python? : r/learnpython
Subreddit for posting questions and asking for general advice about all topics related to learning python. More on reddit.com
🌐 r/learnpython
[deleted by user]
Thanks for the tutorial! More on reddit.com
🌐 r/learnpython
26
171
March 2, 2022
About iterating over a list of tuples
I'm not sure what you're asking. It's possible because the implementors of Python made it possible. The other syntax will also work of course, if you want the tuple as a whole, but anywhere you have multiple items you can always destructure them into individual variables. It's exactly the same as doing this for example: a, b = [1, 2] More on reddit.com
🌐 r/learnpython
7
4
November 27, 2024
🌐
Mimo
mimo.org › glossary › python › enumerate-function
Python enumerate Function: Master Index-Based Iteration
The built-in enumerate() function in Python adds a counter to a sequence and returns the combination as an enumerate object. The enumerate() function takes a sequence like a list, tuple, or string, and returns an enumerate object.
🌐
Enki
enki.com › post › what-does-enumerate-mean-in-python
Enki | Blog - What Does enumerate Mean in Python
The enumerate() function is a Python tool that allows you to loop through an iterable—like a list, tuple, or string—and have access to both the index and the element itself.
🌐
W3Schools
w3schools.com › python › ref_func_enumerate.asp
Python enumerate() Function
The enumerate() function adds a counter as the key of the enumerate object. ... Coding fundamentals as bite-sized lessons and challenges. ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: sales@w3schools.com · If you want to report an error, or if you want to make a suggestion, send us an e-mail: help@w3schools.com · HTML Tutorial CSS Tutorial JavaScript Tutorial How To Tutorial SQL Tutorial Python Tutorial W3.CSS Tutorial Bootstrap Tutorial PHP Tutorial Java Tutorial C++ Tutorial jQuery Tutorial
Find elsewhere
🌐
Coursera
coursera.org › tutorials › how to enumerate in python: step by step
How to Enumerate in Python: Step by Step | Coursera
February 24, 2023 - By default, the syntax of Python enumerate is as follows: ... You can adjust the enumerate function to fit your needs by changing its parameters. Enumerate has two parameters: 1. Iterable: The iterable is the sequence, list, or objects you select to enumerate.
🌐
Medium
medium.com › @datasciencejourney100_83560 › enumerate-function-in-py-1289137117e9
Enumerate Function in Python. The enumerate() function in Python is a… | by Rina Mondal | Medium
August 30, 2025 - The enumerate() function in Python is a built-in function that allows you to iterate over an iterable (such as a list, tuple, or string) while also keeping track of the index of each item in the iterable.
🌐
freeCodeCamp
freecodecamp.org › news › what-is-enumerate-in-python
What is enumerate() in Python? Enumeration Example
December 22, 2022 - First, let's look at enumerate(iterable, start=0). ... an iterable, such as a list, tuple, string, dictionary or any object which has the __next__ and __iter__ methods defined (which means it supports iteration).
🌐
freeCodeCamp
freecodecamp.org › news › python-enumerate-what-is-the-enumerate-function-in-python
Python enumerate() – What is the Enumerate Function in Python?
June 8, 2022 - In the example above, we created a list called names. We then converted the names variable into an enumerate object: enumerate(names), and stored it in a variable called enumNames.
🌐
Plain English
python.plainenglish.io › understanding-pythons-enumerate-examples-and-use-cases-1ea7c30276c1
Understanding Python’s enumerate: Examples and Use Cases | Python in Plain English
January 20, 2025 - names = ["John", "Ben", "Alice"] for index, name in enumerate(names): print(str(index+1) + "-" + name, end=" ")… · The author made this story available to Medium members only. If you’re new to Medium, create a new account to read this story on us. ... An automation engineer and derivative trader with a passion for writing about everything. ... New Python content every day.
🌐
Python Reference
python-reference.readthedocs.io › en › latest › docs › functions › enumerate.html
enumerate — Python Reference (The Right Way) 0.1 documentation
The next() method of the iterator returned by enumerate() returns a tuple containing a count (from start which defaults to 0) and the values obtained from iterating over sequence.
🌐
Markdown Guide
markdownguide.org › basic-syntax
Basic Syntax | Markdown Guide
The numbers don’t have to be in numerical order, but the list should start with the number one.
🌐
PrepBytes
prepbytes.com › home › python › enumerate function in python
Enumerate Function in Python
June 30, 2023 - The enumerate() function in Python is a built-in method that provides an elegant way to iterate over a sequence while keeping track of the index or position of each element. It takes an iterable (such as a list, tuple, or string) as input and ...
🌐
Reddit
reddit.com › r › learnpython › comments › 6qty5y › what_does_enumerate_do_in_python
What does enumerate do in python? : r/learnpython
Subreddit for posting questions and asking for general advice about all topics related to learning python.
🌐
Analytics Vidhya
analyticsvidhya.com › home › python enumerate(): simplify looping with counters
Python enumerate(): Simplify Looping With Counters | Analytics Vidhya
July 12, 2024 - A. In Python, the enumerates function enumerates objects. Enumerated returns objects containing counters for each value in objects, making items in collections easier to locate. Keys indicate the contents of a list.
🌐
Matplotlib
matplotlib.org › stable › gallery › color › named_colors.html
List of named colors — Matplotlib 3.11.2 documentation
import math import matplotlib.pyplot as plt import matplotlib.colors as mcolors from matplotlib.patches import Rectangle def plot_colortable(colors, *, ncols=4, sort_colors=True): cell_width = 212 cell_height = 22 swatch_width = 48 margin = 12 # Sort colors by hue, saturation, value and name. if sort_colors is True: names = sorted( colors, key=lambda c: tuple(mcolors.rgb_to_hsv(mcolors.to_rgb(c)))) else: names = list(colors) n = len(names) nrows = math.ceil(n / ncols) width = cell_width * ncols + 2 * margin height = cell_height * nrows + 2 * margin dpi = 72 fig, ax = plt.subplots(figsize=(widt
🌐
Python
docs.python.org › 3 › builtins › functions.html
Built-in Functions — Python 3.14.7 documentation
>>> seasons = ['Spring', 'Summer', 'Fall', 'Winter'] >>> list(enumerate(seasons)) [(0, 'Spring'), (1, 'Summer'), (2, 'Fall'), (3, 'Winter')] >>> list(enumerate(seasons, start=1)) [(1, 'Spring'), (2, 'Summer'), (3, 'Fall'), (4, 'Winter')] ... The result of the evaluated expression. ... Syntax errors are reported as exceptions. ... This function executes arbitrary code. Calling it with untrusted user-supplied input will lead to security vulnerabilities. The source argument is parsed and evaluated as a Python expression (technically speaking, an expression list) using the globals and locals mappings as global and local namespace.
🌐
LabEx
labex.io › home › builtin › enumerate
Python enumerate() built-in function - Python Cheat Sheet
Return an enumerate object. iterable must be a sequence, an iterator, or some other object which supports iteration. The __next__() method of the iterator returned by enumerate() returns a tuple containing a count (from start which defaults ...
🌐
Python documentation
docs.python.org › 3 › tutorial › controlflow.html
4. More Control Flow Tools — Python 3.14.7 documentation
>>> list(range(5, 10)) [5, 6, 7, 8, 9] >>> list(range(0, 10, 3)) [0, 3, 6, 9] >>> list(range(-10, -100, -30)) [-10, -40, -70] To iterate over the indices of a sequence, you can combine range() and len() as follows: >>> a = ['Mary', 'had', 'a', 'little', 'lamb'] >>> for i in range(len(a)): ... print(i, a[i]) ... 0 Mary 1 had 2 a 3 little 4 lamb · In most such cases, however, it is convenient to use the enumerate() function, see Looping Techniques.