Skip to content

Commit

Permalink
Update calculator.py
Browse files Browse the repository at this point in the history
Prioritized lowering the input
  • Loading branch information
ilia-abbasi authored Oct 24, 2023
1 parent 76725dc commit bc3fd39
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ def calc(term):
purpose: This function is the actual calculator and the heart of the application
"""

# This part is for reading and converting function expressions.
term = term.lower()

# This part is for reading and converting arithmetic terms.
term = term.replace(" ", "")
term = term.replace("^", "**")
Expand All @@ -61,9 +64,6 @@ def calc(term):
"e",
]

# This part is for reading and converting function expressions.
term = term.lower()

for func in functions:
if func in term:
withmath = "math." + func
Expand Down

0 comments on commit bc3fd39

Please sign in to comment.