Home / Python Tips Generated By ChatGPT / Using enumerate() for Index-Value Pairs in Python Use enumerate() when looping through a sequence and you need both the index and the value. Source Code for index, value in enumerate(["red", "green", "blue"]): print(f"{index}: {value}")