On 20/04/06, Carroll, Barry <[EMAIL PROTECTED]> wrote: > The following code fragment does the job but seems sort of brutish and > inelegant to me: > > >>>>>>> > >>> s = '987654321' > >>> odd = '' > >>> for c in s[::-2]: > ... odd = c + odd > ... > >>>
String slicing will actually produce strings :-) eg: >>> s = '987654321' >>> s1, s2 = s[::-2], s[-2::-2] >>> s1 '13579' >>> s2 '2468' -- John. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor