0

I have many lists ,which are named like a+str(i), such as a0. I want to add the two adjacent ones in turn.

a0=['a']
a1=['k']
a2=['e','a']
a3=['k','e']

a0=a0+a1
a1=a1+a2
a2=a2+a3

I want to know whether there are a way to represent the name of the list in batches in python.

I expect to use a for loop to express.

Expected:

for i in range(1,4):
    ai= ai + a(i-1)
rosefun
  • 1,797
  • 1
  • 21
  • 33

0 Answers0