<jupyter_start><jupyter_text>All the IPython Notebooks in this **Python Examples** series by Dr. <NAME> are available @ **[GitHub](https://github.com/milaan9/90_Python_Examples)**  Python Program to Access Index of a List Using for LoopIn this example, you will learn to access the index of a list using a for loop.To understand this example, you should have the knowledge of the following **[Python programming](https://github.com/milaan9/01_Python_Introduction/blob/main/000_Intro_to_Python.ipynb)** topics:* **[Python for Loop](https://github.com/milaan9/03_Python_Flow_Control/blob/main/005_Python_for_Loop.ipynb)*** **[Python List](https://github.com/milaan9/02_Python_Datatypes/blob/main/003_Python_List.ipynb)*** **[Python enumerate()](https://github.com/milaan9/04_Python_Functions/blob/main/002_Python_Functions_Built_in/018_Python_enumerate%28%29.ipynb)**<jupyter_code># Example 1: Using enumerate

my_list = [21, 33, 66, 77]

for index, val in enumerate(my_list):
    print(index, val)

'''
>>Output/Runtime Test Cases:
     
0 21
1 33
2 66
3 77
'''<jupyter_output>0 21
1 33
2 66
3 77<jupyter_text>**Explanation:** Using **[enumerate()](https://github.com/milaan9/04_Python_Functions/blob/main/002_Python_Functions_Built_in/018_Python_enumerate%28%29.ipynb)**, we can print both the index and the values.* Pass two loop variables **`index`** and **`val`** in the for loop. You can give any name to these variables.* Print the required variables inside the for loop block.The function of **`enumerate()`** is to add a counter (i.e. **`index`**) to the iterate and return it. If you want to learn more about **`enumerate()`**, please visit **[Python enumerate()](https://github.com/milaan9/04_Python_Functions/blob/main/002_Python_Functions_Built_in/018_Python_enumerate%28%29.ipynb)**.<jupyter_code># Example 2: Start the indexing with non zero value

my_list = [21, 33, 66, 77]

for index, val in enumerate(my_list, start=1):
    print(index, val)
    
'''
>>Output/Runtime Test Cases:
     
1 21
2 33
3 66
4 77
'''<jupyter_output>1 21
2 33
3 66
4 77<jupyter_text>**Explanation:** The value of the parameter **`start`** provides the starting index.<jupyter_code># Example 3: Without using enumerate()

my_list = [21, 33, 66, 77]

for index in range(len(my_list)):
    value = my_list[index]
    print(index, value)
    
'''
>>Output/Runtime Test Cases:
     
1 21
2 33
3 66
4 77
'''<jupyter_output>0 21
1 33
2 66
3 77
{'fraction_non_alphanumeric': 0.13179571663920922, 'fraction_numerical': 0.06589785831960461, 'mean_word_length': 5.244215938303342, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 17, 'https://': 7, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '213157', 'license': 'MIT', 'n_tokens_mistral': 968, 'n_tokens_neox': 822, 'n_words': 253, 'path': '02_Python_Datatypes_examples/010_access_index_of_a_list_using_for_loop.ipynb', 'repo_name': 'peterennis/90_Python_Examples', 'size': '2435'}