0

I created a list like this:

a=list('Testing 123')[::2]
b=list('Testing 123')[1::2]

So how do I make a make a new list which adds them like they originally were?

bereal
  • 32,519
  • 6
  • 58
  • 104
sumit.viii
  • 11
  • 2

1 Answers1

2

Here's one way to do it:

>>> a, b
(['T', 's', 'i', 'g', '1', '3'], ['e', 't', 'n', ' ', '2'])
>>> c = [None]*(len(a)+len(b))
>>> c[::2], c[1::2] = a, b
>>> ''.join(c)
'Testing 123'
Duncan
  • 92,073
  • 11
  • 122
  • 156