Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок0
Enumerate function.
Can anyone please explain this function with the help of an example? I'm having difficulty in understanding the example given in Sololearn...!!
2 ответов
+ 8
enumerate() iterates through a collection and returns pairs of the element's index number and the element itself.
collection = ["abc", "solo", "learn"]
print(list(enumerate(collection)))
The output will be:
[(0, 'abc'), (1, 'solo'), (2, 'learn')]
+ 4
https://www.programiz.com/JUMP_LINK__&&__python__&&__JUMP_LINK-programming/methods/built-in/enumerate
Try this tutorial instead, I think the two examples there explain it pretty well (: