<jupyter_start><jupyter_text>enumerate(iterable, start=0)`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 to 0) and the values obtained from iterating over iterable**. If you've ever wanted to keep track of both index and value when manipulating a list,you probably did something like this:<jupyter_code>fibonacci = [1, 1, 2, 3, 5, 8, 13, 21]
for i in range(len(fibonacci)):
    print("The {}th fibonacci number is {}.".format(i, fibonacci[i]))<jupyter_output>The 0th fibonacci number is 1.
The 1th fibonacci number is 1.
The 2th fibonacci number is 2.
The 3th fibonacci number is 3.
The 4th fibonacci number is 5.
The 5th fibonacci number is 8.
The 6th fibonacci number is 13.
The 7th fibonacci number is 21.<jupyter_text>But if we wanted to start counting from 1 or something, we would need to do:<jupyter_code>fibonacci = [1, 1, 2, 3, 5, 8, 13, 21]
for i in range(len(fibonacci)):
    print("The {}th fibonacci number is {}.".format(i+1, fibonacci[i]))<jupyter_output>The 1th fibonacci number is 1.
The 2th fibonacci number is 1.
The 3th fibonacci number is 2.
The 4th fibonacci number is 3.
The 5th fibonacci number is 5.
The 6th fibonacci number is 8.
The 7th fibonacci number is 13.
The 8th fibonacci number is 21.<jupyter_text>You can achieve the same results using the `enumerate()` function, but you instead getseparate variables for your index and element, so it's a bit easier to read.<jupyter_code>fibonacci = [1, 1, 2, 3, 5, 8, 13, 21]

for index, number in enumerate(fibonacci):
    print("The {}th fibonacci number is {}.".format(index, number))<jupyter_output>The 0th fibonacci number is 1.
The 1th fibonacci number is 1.
The 2th fibonacci number is 2.
The 3th fibonacci number is 3.
The 4th fibonacci number is 5.
The 5th fibonacci number is 8.
The 6th fibonacci number is 13.
The 7th fibonacci number is 21.<jupyter_text>In more difficult problems, referring to `i+1`for counting, but using index `i`, could get confusing since they don't match. In this scenario, the `enumerate()` function gives us a little more flexibility sincewe can specify any `start` that we want:<jupyter_code>fibonacci = [1, 1, 2, 3, 5, 8, 13, 21]

for index, number in enumerate(fibonacci, start=1):
    print("The {}th fibonacci number is {}.".format(index, number))<jupyter_output>The 1th fibonacci number is 1.
The 2th fibonacci number is 1.
The 3th fibonacci number is 2.
The 4th fibonacci number is 3.
The 5th fibonacci number is 5.
The 6th fibonacci number is 8.
The 7th fibonacci number is 13.
The 8th fibonacci number is 21.
{'fraction_non_alphanumeric': 0.08657047724750278, 'fraction_numerical': 0.0436551979282279, 'mean_word_length': 4.668763102725367, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '370956', 'license': 'MIT', 'n_tokens_mistral': 1015, 'n_tokens_neox': 890, 'n_words': 411, 'path': 'built_in_functions/.ipynb_checkpoints/enumerate-checkpoint.ipynb', 'repo_name': 'HackBinghamton/Intermediate-Python-Tutorial', 'size': '2703'}