Skip to content

Instantly share code, notes, and snippets.

@MagicHen25
Created February 13, 2017 14:38
Show Gist options
  • Save MagicHen25/15984582fca45112102f4d74a0def7d9 to your computer and use it in GitHub Desktop.
Save MagicHen25/15984582fca45112102f4d74a0def7d9 to your computer and use it in GitHub Desktop.
import re
def multiplyDivideFunc(inStr):
outList = list()
if "*" in inStr:
# print("Multiply in inStr")
outList = inStr.split("*")
# print(float(outList[0])*float(outList[1]))
return float(outList[0])*float(outList[1])
elif "/" in inStr:
# print("Divide in inStr")
outList = inStr.split("/")
# print(float(outList[0]) / float(outList[1]))
return float(outList[0]) / float(outList[1])
else:
# print("Only a digit:", float(inStr))
return float(inStr)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment