Parsing/RPN to infix conversion: Difference between revisions

m (tiny error in js solution)
Line 2,284:
 
=={{header|Python}}==
{{incorrect|Python|heredoc says rpn_to_infix('3 4 5 - *') gives '(3 - 4) * 5'. Correct answer is '3 * (4 - 5)'.}}
 
This example can also handle variables (x, y, pi, e, ...), variable negations('5 -4 +' -> '5 - 4' and '5 -4 -' -> '5 + 4'), and unary operators (abs, sqrt, exp, ln, log, sin, cos, tan).
7,804

edits