Is there a way to loop through a sub section of a list in Python
Question: So for a list that has 1000 elements, I want to loop from 400 to 500. How do
you do it?

I don't see a way by using the for each and for range techniques.


Answer: 
    for x in thousand[400:500]:
        pass
    

If you are working with an iterable instead of a list, you should use
[itertools](http://docs.python.org/library/itertools):

    
    
    import itertools
    for x in itertools.islice(thousand, 400, 500):
        pass
    

If you need to loop over `thousand[500]`, then use 501 as the latter index.
This will work even if `thousand[501]` is not a valid index.

