Why use enumerate() instead of range() in your python's loops
2 min readJan 7, 2021
--
enumerate() is faster when you want to repeatedly access the list/iterable items at their index. When you just want a list of indices, it is faster to use len() and range().
The range()
function is often useful when iterating over a set of integers:
for n in range(200):
print(n)
#
for n in range(50, 110):
print(n)