Skip to content

Commit

Permalink
Update evaluate.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ikostan committed Oct 30, 2024
1 parent 8a8a248 commit c260c5c
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions kyu_2/evaluate_mathematical_expression/evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def calc(string: str) -> float:
return float(string)


def check_conditions(strings, string, temp) -> (str, str):
def check_conditions(strings, string, temp) -> [str, str]:
"""
Check conditions
:param strings:
Expand All @@ -170,9 +170,10 @@ def check_conditions(strings, string, temp) -> (str, str):
if s.isdigit():
temp += s

Check notice on line 172 in kyu_2/evaluate_mathematical_expression/evaluate.py

View check run for this annotation

codefactor.io / CodeFactor

kyu_2/evaluate_mathematical_expression/evaluate.py#L172

Variable name "s" doesn't conform to snake_case naming style (invalid-name)
if (s in ''.join(OPERATORS) + '()' or i == len(string) - 1) and temp:
strings.append(temp)

if s in '()':
if temp != '':
strings.append(temp)
strings.append(s)

if i + 1 < len(string):
Expand All @@ -182,17 +183,13 @@ def check_conditions(strings, string, temp) -> (str, str):
break

if s in OPERATORS:
if temp != '':
strings.append(temp)
strings.append(s)

if i + 1 < len(string):
string = string[i + 1:]
break

if i == len(string) - 1:
if temp != '':
strings.append(temp)
string = ''

return temp, string
Expand Down

0 comments on commit c260c5c

Please sign in to comment.