I have no idea what to do from here:(. Pls help, thank you!
special_char = string.punctuation.replace("-", "")
equations = ["plus", "minus", "divided", "multiplied"]
def answer(question):
translator = str.maketrans("", "", special_char)
question = question.translate(translator)
question = question.lower().split()
print(question)
full_equations = []
num_counter = 0
for i in question:
if i.strip("-").isnumeric():
if question.index(i) < len(question) - 1:
if question[question.index(i) + 1] not in equations:
raise ValueError("unknown operation")
i = int(i)
num_counter += 1
full_equations.append(i)
elif i in equations:
full_equations.append(i)
if num_counter == 0:
raise ValueError("unknown operation")
equation_flow = full_equations[0]
for i in range(1, len(full_equations), 2): # Step by 2 to get operators
operator = full_equations[i]
next_number = full_equations[i + 1]
if operator == "plus":
equation_flow += next_number
elif operator == "multiplied":
equation_flow *= next_number
elif operator == "minus":
equation_flow -= next_number
elif operator == "divided":
equation_flow //= next_number # Using integer division
return equation_flow
print(answer("What is 52"))```