Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis0
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 Respostas
+ 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 (: