Slicing Arrays in this way

John Machin sjmachin at lexicon.net
Wed May 2 19:01:05 EDT 2007


On May 3, 8:55 am, Steven D'Aprano
<s... at REMOVE.THIS.cybersource.com.au> wrote:
> 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
>

The OP has already confessed. Don't rub it in.






More information about the Python-list mailing list