Anonymous user
List comprehensions: Difference between revisions
→{{header|Python}}: removed the generator function example as it is not a comprehension and is syntactically not close.
(Extracted some salient points from the WP article for clarification.) |
(→{{header|Python}}: removed the generator function example as it is not a comprehension and is syntactically not close.) |
||
Line 112:
<lang python>[(x,y,z) for x in xrange(1,n+1) for y in xrange(x,n+1) for z in xrange(y,n+1) if x**2 + y**2 == z**2]</lang>
<lang python>((x,y,z) for x in xrange(1,n+1) for y in xrange(x,n+1) for z in xrange(y,n+1) if x**2 + y**2 == z**2)</lang>
|