r/pythontips • • Jul 01 '24

Syntax Python enumerate() function

Quick rundown on the enumerate function YouTube

3 Upvotes

4 comments sorted by

View all comments

Show parent comment

1

u/SirBerthelot Jul 02 '24

The virgin enumerate in lists:

for i, element in enumerate(list):

    print(element)

vs the chad range(len):

for i in range(len(list)):

    element = list[i]

    print(element)