How to split in python using several characters

Hello, I am trying to do the first project for a python course and it’s not going very well. I need a way to split the mathematical expressions by the operands but .split("+") only splits them by the + sign and I need a way to split them by + when there is a +, and by - when there is a -

def arithmetic_arranger(problems):
  y = list()
  for x in problems:
    y.append(x.strip().split("[-+]?"))
  print(y)
  




print(arithmetic_arranger(["32 + 698", "3801 - 2", "45 + 43", "123 + 49"]))

I think you may want to use

Hi,

I recommend you to store the operator in a variable first, then split the problem at the previous stored operator.

operator = ...your code goes here...
# only "+" or "-" allowed:
if operator fails on  my test:
    return "Error: Operator must be '+' or '-'"

numbers = problem.split(operator)