The built-in ‘enumerate’ function in Python allows us to iterate over a sequence such as a list, tuple, or string and it also keeps track of the current index of the current item.
Python
countries = ['USA', 'UK', 'Canada', 'Australia']
for index, country in enumerate(countries):
print(f"Index: {index}, Country: {country}")
Index: 0, Country: USA
Index: 1, Country: UK
Index: 2, Country: Canada
Index: 3, Country: Australia