For loops (novice)
I recently started learning Python, and the concept of for loops is still a little confusing for me. I understand that it generally follows the format for x in y , where y is just some list. The for-each loop for (int n: someArray) becomes for n in someArray , And the for loop for (i = 0; i < 9; i-=2) can be represented by for i in range(0, 9, -2) Suppose instead of a constant increment, I wanted i*=2 , or even i*=i . Is this possible, or would I have to use a while loop instead? As you say, a for loop iterates through the elements of a list. The list can contain anything you like, so you can