a1 = 0
a2 = 1
x = [] #here I have declared an empty list
for i in range(2):
x.append('a'+str(i+1)) #to append the variable with a numbering scheme
print (x)
This is a sample python code. A similar situation that I am facing in a programming task .
Here the output is ['a1','a2']
instead I need the output as [0,1]
. Can someone help me with this ?