Prefix Notation Evaluation

Published by persolut in

Create a function that takes a mathematical expression in prefix notation as a string and evaluates the expression.

Examples

Prefix("+ 5 4") ➞ 9

Prefix("* 12 2") ➞ 24

Prefix("+ -10 10") ➞ 0

Notes

  • The mathematical expression is valid.
  • Check the Resources.
Watch a quick demo on how Edabit works.