3 ms·
Not convinced by this one: http://facts.learnpython.org/1004 http://facts.learnpython.org/1004
by gren 15y ago
Not convinced by this one: http://facts.learnpython.org/1004 http://facts.learnpython.org/1004
- RyanMcGreal 15y agoI prefer: [int(x) for x in "10 20 30".split(' ')]
- omaranto 15y agoWhy? It's longer and requires an extra check to make sure that it's the same variable mentioned twice (i.e., you read to read it carefully to distinguish from [int(x) for y in "10 20 30".split(' ')]). Is it just that since comprehensions are more commonly used you think some people might forget what map does nad have to look it up?
- trafficlight 15y agoThis one doesn't give me any output.
- ThePawnBreak 15y agoYou need to print the value.