[Tutor] Adding index numbers to tuple

Timo timomlists at gmail.com
Tue Aug 16 15:10:53 CEST 2011

Maybe a bit confusing topic title, probably the example will do.

I have a tuple:
t = ('a', 'b', 'c', 'd')
And need the following output, list or tuple, doesn't matter:
(0, 'a', 1, 'b', 2, 'c', 3, 'd')

I tried with zip(), but get a list of tuples, which isn't the desired
output. Anyone with a solution or push in the right direction?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110816/487fbd25/attachment.html>

More information about the Tutor mailing list