On May 2, 3:03 pm, Tobiah <[EMAIL PROTECTED]> wrote: > >>> elegant_solution([1,2,3,4,5,6,7,8,9,10]) > [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]] > > -- > Posted via a free Usenet account fromhttp://www.teranews.com
>>> seq = range(1,11) >>> seq [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] >>> zip( seq[0::2],seq[1::2] ) [(1, 2), (3, 4), (5, 6), (7, 8), (9, 10)] if you _really_ need lists then... >>> map(list, zip( seq[0::2],seq[1::2] )) [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]] -- http://mail.python.org/mailman/listinfo/python-list