I’m reading about for loops right now, and I am curious if it’s possible to do a for loop in Python like in Java.
Is it even possible to do something like
for (int i = 1; i < list.length; i++)
and can you do another for loop inside this for loop ?
Thanks
In Python you can iterate over the
listitself:or to use indices you can use
xrange():There’s another built-in function called
enumerate(), which returns both item and index:examples: