nested for loops

Peter Otten __peter__ at web.de
Tue Mar 21 23:05:19 CET 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