MCPcopy Create free account
hub / github.com/ActiveState/code / PostfixSubEval

Function PostfixSubEval

recipes/Python/228915_InfixPostfix/recipe-228915.py:133–145  ·  view source on GitHub ↗
(num1,num2,sym)

Source from the content-addressed store, hash-verified

131 return(tokens)
132
133def PostfixSubEval(num1,num2,sym):
134 num1,num2 = float(num1),float(num2)
135 if(sym == "+"):
136 returnVal = num1 + num2
137 if(sym == "-"):
138 returnVal = num1 - num2
139 if(sym == "*"):
140 returnVal = num1 * num2
141 if(sym == "/"):
142 returnVal = num1 / num2
143 if(sym == "^"):
144 returnVal = pow(num1,num2)
145 return returnVal
146
147def PostfixEval(postfixStr):
148 temp = postfixStr

Callers 1

PostfixEvalFunction · 0.85

Calls 1

powFunction · 0.50

Tested by

no test coverage detected