Slicing Arrays in this way

Michael Hoffman cam.ac.uk at mh391.invalid
Wed May 2 20:21:42 EDT 2007


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

That's not an array, it's a list. See the array module for arrays 
(fixed-length, unlike variable-length lists).
-- 
Michael Hoffman



More information about the Python-list mailing list