Workout 26 #Prefix Notation Calculator
For this exercise, I want you to write a function (calc) that expects a single argument — a string containing a simple math expression in prefix notation — with an operator and two numbers. Your program will parse the input and produce the appropriate output. For our purposes, it’s enough to handle the six basic arithmetic operations in Python: addition, subtraction, multiplication, division (/), modulus (%), and exponentiation (**). The normal Python math rules should work, such that division always results in a floating-point number. We’ll assume, for our purposes, that the argument will only contain one of our six operators and two valid numbers.
prefix notation, in which the operator precedes the arguments. Using prefix notation, we would write + 2 3.
TRY IT YOURSELF
ANSWER
https://colab.research.google.com/drive/1Bptfc_yVr5tR52Kp71WWObn07IHHBmIn?usp=sharing