[Python-Dev] re: list comprehension / pop quiz
Guido van Rossum
guido@beopen.com
Tue, 11 Jul 2000 15:03:12 -0500
> Yes, I'll have a roomful of people Thursday morning (practicing my talk
> for Monterey). If someone would like to rephrase the example, I'd be
> happy to do a show-of-hands poll.
Suppose this code:
for i in (1, 2, 3):
print i
prints this:
1
2
3
What do you think the following code would print?
for i in (10, 20, 30); j in (1, 2, 3):
print i+j
A.
11
22
33
B.
11
12
13
21
22
23
31
32
33
I'm afraid the answer will be the same, if these are again numerical
analysts -- these people live by nested DO loops. :-(
--Guido van Rossum (home page: http://dinsdale.python.org/~guido/)