May-02-2019, 10:59 AM
(This post was last modified: May-02-2019, 11:01 AM by ichabod801.)
I think the problem might be that you keep removing the results after inserting them. Take lines 67 and 68. You insert the result of the subtraction, and then immediately remove that same position.
The first part of the program seems overly complicated. It looks like you want to make sure there are no spaces except there must be spaces around the operators (so the split works to make a list of numbers and operators). Wouldn't it be simpler to just use replace for each operator (
Also, I think slice assignment would work better than all that popping and inserting:
The first part of the program seems overly complicated. It looks like you want to make sure there are no spaces except there must be spaces around the operators (so the split works to make a list of numbers and operators). Wouldn't it be simpler to just use replace for each operator (
replace('+', ' + ')
)?Also, I think slice assignment would work better than all that popping and inserting:
s[s.index(i)-1:s.index(i)+2] = [v]
.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures