Python: for statement behavior

Posted by BandGap on Stack Overflow See other posts from Stack Overflow or by BandGap
Published on 2010-05-05T10:16:28Z Indexed on 2010/05/05 10:18 UTC
Read the original article Hit count: 174

Filed under:
|
|

Hi all.

My question concerns the output of this statement:

for x in range(4), y in range(4):
    print x
    print y

Results in:

[0, 1, 2, 3]
2
True
2

It seems there is a comparison involved, I just can't figure out why the output is structured like this.

© Stack Overflow or respective owner

Related posts about python

Related posts about pythonic