Issue
I seem to recall there is a built-in way of doing this:
i = 0
for value in values:
# ...Stuff
i += 1
but in a neater syntax; something like
for value, i in fn(values):
# ...Stuff
Is my memory correct; and if so, what is the way of doing this?
Solution
for i, value in enumerate(values):
Answered By - Amber
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.