Google News
logo
Python - Interview Questions
What is the usage of enumerate () function in Python?
The enumerate() function is used to iterate through the sequence and retrieve the index position and its corresponding value at the same time.
 
For i,v in enumerate(['Python','Java','C++']):  
print(i,v)  
0 Python  
1 Java  
2 C++  
# enumerate using an index sequence  
for count, item in enumerate(['Python','Java','C++'], 10):  
Advertisement