Question:

What is the use of enumerate() in Python?

Answer:

Using enumerate() function you can 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++


Keywords:

© 2017 QuizBucket.org