Slicing Arrays in this way

Steven D'Aprano steve at REMOVE.THIS.cybersource.com.au
Wed May 2 18:55:19 EDT 2007


On Wed, 02 May 2007 15:03:24 -0700, Tobiah wrote:

> 
>  >>> elegant_solution([1,2,3,4,5,6,7,8,9,10])
> [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]

Wow! That's impressive. What version of Python are you using? When I try
it, I get this:

>>> elegant_solution([1,2,3,4,5,6,7,8,9,10])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'elegant_solution' is not defined



-- 
Steven.




More information about the Python-list mailing list