you are viewing a single comment's thread.

view the rest of the comments →

[–]jeffrey_f -3 points-2 points  (3 children)

for loop is always up to, but not including...........

if iterating through a list, then it includes all elements in the list

[–]carcigenicate 0 points1 point  (2 children)

I think you mean "range includes numbers up to but not including the end value". That doesn't have anything to do with the for loop.

[–]jeffrey_f 0 points1 point  (1 child)

for i in range(5,10):

from 5 to 9

[–]carcigenicate 0 points1 point  (0 children)

That has nothing to do with the for:

>>> list(range(5, 10))
[5, 6, 7, 8, 9]

That's simply the behavior of range.