I am trying write a code for envaluation of postfix expression but I failed from the very beginning.
I put the postfix expression to a list and I am trying to split it like ["2","+","3","*","(","4","+","2",")"]
, but I could not do that. What am I doing wrong with that?
Here is the related code:
print(convertx(infix))
a=convertx(infix)
listtt=[]
listtt.append((a))
x=listtt[0]
for i in range(len(x)):
for n in range
li=[x[:-i]]
print(li)
This is not working clearly. I look at the code. a
is a string which is consist of postfix expression and I converted it to a list.
EDIT:I tried to write this code:
print(convertx(infix))
a=convertx(infix)
listtt=[]
listtt.append((a))
x=listtt[0]
for i in range(len(x)):
for n in range
li=[x[:-i]]
But when I write this code I am just getting ['3'] as output but I want is getting them like:
["3","2","4","2","+",",""6","3","/","+","*"]