Skip to content

Instantly share code, notes, and snippets.

@MagicHen25
Created February 13, 2017 14:38
Show Gist options
  • Select an option

  • Save MagicHen25/15984582fca45112102f4d74a0def7d9 to your computer and use it in GitHub Desktop.

Select an option

Save MagicHen25/15984582fca45112102f4d74a0def7d9 to your computer and use it in GitHub Desktop.

Revisions

  1. MagicHen25 created this gist Feb 13, 2017.
    18 changes: 18 additions & 0 deletions func.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    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)