Question: In Mathematics, we typically use PEMDAS (or sometimes called GEMDAS) to get the order of our operations. We first start by solving for whatever is

In Mathematics, we typically use PEMDAS (or sometimes called GEMDAS) to get the order of our operations. We first start by solving for whatever is inside the parentheses (or groups if you're using GEMDAS), then we solve for exponents, then we multiply/divide, then finally add/substract. In Python, we can typically pass any math equation to the eval() function to solve it, however we can also write a program using recursion to solve for the equations. Task Write a recursive program that will solve for any given PEMDAS equations. You are to write a function pemdas() that will solve the given input. Copy pemdas (equation): # your code here Input Inputs will be given as a list of tokens with each token signifying either a number or an operation. For example, if we have the equation (1 + 2) 2)^3, the input will be the list ["(", "1", "+"| ", "+ "2", ")", "A" 1 "3"] Output Return the answer to the problem as a float
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
