On 17/10/06, Asrarahmed Kadri <[EMAIL PROTECTED]> wrote: > My solution : (i have tested it)
As long as we're all taking turns, what about a functional approach: >>> a = [10, 15, 18, 20, 25, 30, 40] >>> def pairs(lst): ... return list.__add__([(lst[0], lst[1])], zip(map((1).__add__, lst[1:]), lst[2:])) ... >>> pairs(a) [(10, 15), (16, 18), (19, 20), (21, 25), (26, 30), (31, 40)] -- John. _______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
