nested for loops

Peter Otten __peter__ at web.de
Tue Mar 21 17:05:19 EST 2006


John Salerno wrote:

> Can someone tell me why 'n' in this example isn't 2?
> 
>  >>> for n in range(2, 10):
> for x in range(2, n):
> print 'x =', x, 'n =', n
> 
> 
> x = 2 n = 3

Hint:

>>> range(2, 2)
[]

Peter



More information about the Python-list mailing list