Getting the index of 'for' loops
Saved by @bravocoder #python
Using an additional state variable, such as an index variable (which you would normally use in languages such as C or PHP), is considered non-pythonic. The better option is to use the built-in function enumerate(), available in both Python 2 and 3.
https://stackoverflow.com/questions/522563/accessing-the-index-in-for-loops
Comments