Home / Python Tips Generated By ChatGPT / The enumerate Function in Python Use enumerate to get both the index and the value of items in a list during a loop. Source Code fruits = ["apple", "banana", "cherry"] for index, fruit in enumerate(fruits): print(index, fruit)