Skip to content

Instantly share code, notes, and snippets.

@wellington-tinho
Last active November 4, 2020 03:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wellington-tinho/70f61b284defccd47fd377304c6c97cd to your computer and use it in GitHub Desktop.
Save wellington-tinho/70f61b284defccd47fd377304c6c97cd to your computer and use it in GitHub Desktop.
def calcPosFix():
expression=list(input('insira a expressao: '))
while(len(expression)>1):
if (len(expression)>3 and expression[2] == '*' and expression[3] == '*' ):
value = str(eval(expression[0])**(eval(expression[1])))
for i in range(4):
del expression[0]
else:
value = str(eval(expression[0]+expression[2]+expression[1]))
for i in range(3):
del expression[0]
expression.insert(0,value)
print(expression)
calcPosFix()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment