---
description: What is Python Enumerate? Enumerate() function is a built-in function available with python. Enumerate() command adds a counter to each item of the iterable object and returns an enumerate object. In
title: "Python enumerate() Function: Loop, Tuple &#038; String"
image: https://www.guru99.com/images/python-enumerate-function.png
---

[Skip to content](#main)

**⚡ Smart Summary**

Python enumerate() adds an automatic counter to any iterable, returning index-value pairs as you loop. Here you will learn its syntax, the optional start index, and how it works on lists, tuples, strings, and dictionaries.

- 🔢 **What it does:** Adds a counter to each item of an iterable, returning index-value pairs.
- ⚙️ **Syntax:** enumerate(iterable, startIndex) takes an iterable plus an optional start number.
- 🔟 **Custom start:** startIndex sets where counting begins; omit it to start at 0.
- 🔁 **Looping:** Pair it with a for-loop to read index and value together.
- 📦 **Any iterable:** Works on lists, tuples, strings, and dictionaries.
- 🤖 **AI help:** Copilot and AI tools autocomplete enumerate() loops and refactor manual counters.

Read More

![Enumerate() Function in Python](https://www.guru99.com/images/python-enumerate-function.png)

## What is Python Enumerate?

**Python Enumerate()** is a buit-in function available with the Python library. It takes the given input as a collection or tuples and returns it as an enumerate object. The Python Enumerate() command adds a counter to each item of the iterable object and returns an enumerate object as an output string.

## Syntax of Python enumerate()

```
enumerate(iterable, startIndex)
```

### Parameters

Three parameters are:

- **Iterable**: an object that can be looped.
- **StartIndex**: (optional) The count will start with the value given in the startIndex for the first item in the loop and increment it for the nextitem till it reaches the end of the loop.

However, If startIndex is not specified, the count will start from 0.

### ReturnValue

It will return an iterableobject, with countvalue to each of the items to the iteratorobject given as input.

## Enumerate() in Python Example

Enumerate method comes with an automatic counter/index to each of the items present in the Enumerate list in Python. The firstindex value will start from 0. You can also specify the startindex by using the optional parameter startIndex in enumerate.  
**Example**  
 In the code below, mylist is the list given to Enumerate function in Python. The [list() function](https://www.guru99.com/python-list-comprehension-sort-examples.html) is used to display the Enumerate Python output.

**Note:** There is no startIndex used hence the index for the firstitem will start from 0.

The output from enumerate will be in the following manner:

```
(0, item_1), (1, item_2), (2, item_3), … (n, item_n)
```

File: python\_enumerate.py

```
mylist = ['A', 'B' ,'C', 'D']
e_list = enumerate(mylist)
print(list(e_list))
```

**Output:**

```
[(0, 'A'), (1, 'B'), (2, 'C'), (3, 'D')]
```

## UsingEnumerate() on a list with startIndex

In the below example, the startindex given as 2.The index of the firstitem will start from the given startindex.

**Example:**

In the example below, mylist is the list given to enumerate. The list() function is used to display the enumerate output.

```
mylist = ['A', 'B' ,'C', 'D']
e_list = enumerate(mylist,2)
print(list(e_list))
```

**Output:**

```
[(2, 'A'), (3, 'B'), (4, 'C'), (5, 'D')]
```

## Looping Over an Enumerate object

The example shows enumerating over an object with and without startIndex.

- The first for-loop does not have startIndex, so the index starts from 0.
- The second for-loop has startIndex as 10, so the index is starting from 10.

**Example:**

```
mylist = ['A', 'B' ,'C', 'D']

for i in enumerate(mylist):
  print(i)
  print("\n")

print("Using startIndex as 10")    

for i in enumerate(mylist, 10):
  print(i)
  print("\n")
```

**Output:**

```
(0, 'A')
(1, 'B')
(2, 'C')
(3, 'D')

Using startIndex as 10
(10, 'A')
(11, 'B')
(12, 'C')
(13, 'D')
```

**Don't Miss:**

- [How to Create (Write) Text File in Python](https://www.guru99.com/reading-and-writing-files-in-python.html)
- [Python round() Function with EXAMPLES](https://www.guru99.com/round-function-python.html)
- [Python Queue: FIFO, LIFO Example](https://www.guru99.com/python-queue-example.html)
- [Python Dictionary Append: How to Add Key/Value Pair](https://www.guru99.com/python-dictionary-append.html)

## Enumerating a Tuple

In the below example, you can use a tuple inside an enumerate. You can also use a startIndex, and the key to each item will start from the startIndexgiven.

By default, the startIndex is 0. There, hence you see key as 0 for items A and 1 for B and so on.

**Example:**

```
my_tuple = ("A", "B", "C", "D", "E")
for i in enumerate(my_tuple):
  print(i)
```

**Output:**

```
(0, 'A')
(1, 'B')
(2, 'C')
(3, 'D')
(4, 'E')
```

## Enumerating a String

In Python, the string is an array, and hence you can loop over it. If you pass a string to enumerate(), the output will show you the index and value for each character of the string.

**Example:**

```
my_str = "Guru99 "
for i in enumerate(my_str):
  print(i)
```

**Output:**

```
(0, 'G')
(1, 'u')
(2, 'r')
(3, 'u')
(4, '9')
(5, '9')
```

## Enumerate a dictionary

In Python, a dictionary is listed in curly brackets, inside these curly brackets, the values are declared.

Each element is a key/value pair and separated by commas. You can use a dictionary inside a enumerate() and see the output.

```
my_dict = {"a": "PHP", "b":"JAVA", "c":"PYTHON", "d":"NODEJS"}
for i in enumerate(my_dict):
  print(i)
```

**Output:**

```
(0, 'a')
(1, 'b')
(2, 'c')
(3, 'd')
```

## Advantages of using Enumerate

Here, are pros/benefits of using Enumerate in Python:

- Enumerate allows you to loop through a list, tuple, dictionary, string, and gives the values along with the index.
- To get index value using for-loop, you can make use of list.index(n). However, list.index(n) is very expensive as it will traverse the for-loop twice. Enumerate is very helpful in such a case as it gives the index and items at one go.

## FAQs

📘 What is the enumerate() function in Python?

enumerate() is a built-in function that adds a counter to an iterable like a list, tuple, string, or dictionary, returning index-value pairs.

⚙️ What is the syntax of Python enumerate()?

The syntax is enumerate(iterable, startIndex). The iterable is any loopable object; startIndex is an optional starting number. Without it, counting begins from 0.

🔟 How do you set a custom starting index with enumerate()?

Pass a second argument, like enumerate(mylist, 2). Counting then starts from that value instead of 0, so the first item gets index 2.

📚 Can enumerate() be used on a dictionary?

Yes. Passing a dictionary loops over its keys, pairing each with an index. Enumerate the dictionary’s items() when you also need the values.

⚡ Why should you use enumerate() instead of a manual counter?

enumerate() is cleaner and faster than a manual index or list.index(n), which scans twice, returning index and item together.

🤖 How can AI tools like GitHub Copilot help when using enumerate()?

AI assistants like GitHub Copilot autocomplete enumerate() loops, suggest a startIndex, and refactor manual counters, speeding up idiomatic Python and catching off-by-one errors.

🧠 Can AI automate converting index-based loops to enumerate()?

Yes. AI-powered linters automate this refactor, spotting range(len(x)) patterns and rewriting them as enumerate(x) for cleaner, more Pythonic loops with identical behaviour.

🔎 What does enumerate() return in Python?

enumerate() returns an enumerate object, an iterator of (index, value) pairs. Loop it directly or wrap it in list() to see all pairs.

#### Summarize this post with:

ChatGPTPerplexityGrokGoogle AI

**Stay Updated on AI** **Get Weekly AI Skills, Trends, Actionable Advice.**

##### Sign up for the newsletter

Subscribe for Free

You have successfully subscribed.  
Please check your inbox.

![AI-Newsletter]() Chosen by over **350,000+** professionals

[Scroll to top](#wrapper)

×

Search for:

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://www.guru99.com/#organization","name":"Guru99","sameAs":["https://www.facebook.com/Guru99Official","https://twitter.com/guru99com"],"logo":{"@type":"ImageObject","@id":"https://www.guru99.com/#logo","url":"https://www.guru99.com/images/guru99-logo-v1-150x59.png","contentUrl":"https://www.guru99.com/images/guru99-logo-v1-150x59.png","caption":"Guru99","inLanguage":"en-US"}},{"@type":"WebSite","@id":"https://www.guru99.com/#website","url":"https://www.guru99.com","name":"Guru99","publisher":{"@id":"https://www.guru99.com/#organization"},"inLanguage":"en-US"},{"@type":"ImageObject","@id":"https://www.guru99.com/images/python-enumerate-function.png","url":"https://www.guru99.com/images/python-enumerate-function.png","width":"700","height":"250","caption":"Python enumerate() Function","inLanguage":"en-US"},{"@type":"BreadcrumbList","@id":"https://www.guru99.com/python-enumerate-function.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":"1","item":{"@id":"https://www.guru99.com","name":"Home"}},{"@type":"ListItem","position":"2","item":{"@id":"https://www.guru99.com/python","name":"Python"}},{"@type":"ListItem","position":"3","item":{"@id":"https://www.guru99.com/python-enumerate-function.html","name":"Python enumerate() Function: Loop, Tuple &#038; String"}}]},{"@type":"WebPage","@id":"https://www.guru99.com/python-enumerate-function.html#webpage","url":"https://www.guru99.com/python-enumerate-function.html","name":"Python enumerate() Function: Loop, Tuple &#038; String","dateModified":"2026-10-07T13:39:20+05:30","isPartOf":{"@id":"https://www.guru99.com/#website"},"primaryImageOfPage":{"@id":"https://www.guru99.com/images/python-enumerate-function.png"},"inLanguage":"en-US","breadcrumb":{"@id":"https://www.guru99.com/python-enumerate-function.html#breadcrumb"}},{"@type":"Person","@id":"https://www.guru99.com/author/editorial","name":"Editorial Team","url":"https://www.guru99.com/author/editorial","image":{"@type":"ImageObject","@id":"https://www.guru99.com/images/favicon-new-logo.png","url":"https://www.guru99.com/images/favicon-new-logo.png","caption":"Editorial Team","inLanguage":"en-US"},"sameAs":["https://www.guru99.com/editorial-team"],"worksFor":{"@id":"https://www.guru99.com/#organization"}},{"articleSection":"Python","headline":"Python enumerate() Function: Loop, Tuple &#038; String","description":"What is Python Enumerate? Enumerate() function is a built-in function available with python. Enumerate() command adds a counter to each item of the iterable object and returns an enumerate object. In","keywords":"python","speakable":{"@type":"SpeakableSpecification","cssSelector":[".entry-title",".summary"]},"@type":"Article","author":{"@id":"https://www.guru99.com/author/editorial","name":"Editorial Team"},"dateModified":"2026-10-07T13:39:20+05:30","image":{"@id":"https://www.guru99.com/images/python-enumerate-function.png"},"copyrightYear":"2026","name":"Python enumerate() Function: Loop, Tuple &#038; String","subjectOf":[{"@type":"FAQPage","mainEntity":[{"@type":"Question","name":"What is the enumerate() function in Python?","acceptedAnswer":{"@type":"Answer","text":"enumerate() is a built-in function that adds a counter to an iterable like a list, tuple, string, or dictionary, returning index-value pairs."}},{"@type":"Question","name":"What is the syntax of Python enumerate()?","acceptedAnswer":{"@type":"Answer","text":"The syntax is enumerate(iterable, startIndex). The iterable is any loopable object; startIndex is an optional starting number. Without it, counting begins from 0."}},{"@type":"Question","name":"How do you set a custom starting index with enumerate()?","acceptedAnswer":{"@type":"Answer","text":"Pass a second argument, like enumerate(mylist, 2). Counting then starts from that value instead of 0, so the first item gets index 2."}},{"@type":"Question","name":"Can enumerate() be used on a dictionary?","acceptedAnswer":{"@type":"Answer","text":"Yes. Passing a dictionary loops over its keys, pairing each with an index. Enumerate the dictionary's items() when you also need the values."}},{"@type":"Question","name":"Why should you use enumerate() instead of a manual counter?","acceptedAnswer":{"@type":"Answer","text":"enumerate() is cleaner and faster than a manual index or list.index(n), which scans twice, returning index and item together."}},{"@type":"Question","name":"How can AI tools like GitHub Copilot help when using enumerate()?","acceptedAnswer":{"@type":"Answer","text":"AI assistants like GitHub Copilot autocomplete enumerate() loops, suggest a startIndex, and refactor manual counters, speeding up idiomatic Python and catching off-by-one errors."}},{"@type":"Question","name":"Can AI automate converting index-based loops to enumerate()?","acceptedAnswer":{"@type":"Answer","text":"Yes. AI-powered linters automate this refactor, spotting range(len(x)) patterns and rewriting them as enumerate(x) for cleaner, more Pythonic loops with identical behaviour."}},{"@type":"Question","name":"What does enumerate() return in Python?","acceptedAnswer":{"@type":"Answer","text":"enumerate() returns an enumerate object, an iterator of (index, value) pairs. Loop it directly or wrap it in list() to see all pairs."}}]}],"@id":"https://www.guru99.com/python-enumerate-function.html#schema-1140344","isPartOf":{"@id":"https://www.guru99.com/python-enumerate-function.html#webpage"},"publisher":{"@id":"https://www.guru99.com/#organization"},"inLanguage":"en-US","mainEntityOfPage":{"@id":"https://www.guru99.com/python-enumerate-function.html#webpage"}}]}
```
