Python for loop isn't iterating '0' from a list!
I tried to make a code to separate an input into numbers and letters(or operators):
g='10+10+20x'
t=[]
for each_g in g:
t.append(each_g)
lol=[]
a=[]
for each_t in t:
if each_t.isdigit():
lol.append(each_t)
x = t.index(each_t)
t.pop(x)
else:
lol = ''.join(lol)
a.append(lol)
a.append(each_t)
lol=[]
print(a)
The desired output would be:
['10', '+', '10', '+', '20', 'x']
but it prints
['1', '+', '1', '+', '2', 'x']
instead.
Is there any problems whit the code or a better solution to make it work as expected?
Thanks.