With this video I explain why in many cases we should use enumerate() instead of range() function in Python for loops.
The way of using range() is ugly: You either need a separate variable assignment to get the element or use a[i] all the time which could theoretically be an expensive operation. The point is that you generally don't want to use range(len(l)) when you want to iterate the elements of a list (although there may still be cases where it makes sense).
I think than enumerate is much more flexible and readable Python coding option than len(l) with range().
Thank you for watching. See you on other tutorials.
Vytautas.
#pythonfunctions
#pythonloops
#pythonbegineers