Understanding pythons enumerate
I started to teach myself some c++ before moving to python and I am used to writing loops such as for( int i = 0; i < 20; i++ ) { cout << "value of i: " << i << endl; } moving to python I frequently find myself using something like this. i = 0 while i < len(myList): if myList[i] == something: do stuff i = i + 1 I have read that this isnt very "pythonic" at all , and I actually find myself using this type of code alot whenever I have to iterate over stuff , I found the enumerate function in Python that I think I am supposed to use but I am not sure how I can write similar code using enumerate