Hey everyone. I looked at multiple solutions for this problem and had the bright idea to combine what I’ve learned but how I now i have some errors. I’d like to know what they are and how I can fix them. Thank you

**Your code so far**

```
def arithmetic_arranger(problems, solve = True):
first = ""
second = ""
lines = ""
sumx = ""
string = ""
if len(problems) > 5:
return "Error: Too many problems."
#split up the equation then iterate through problems
for problem in range (len(problems)):
if "+" in problems(problem):
problems[problem] = problems[problem].split("+")
operators.append("+")
elif "-" in problems(problem):
problems[problem] = problems[problem].split("-")
operators.append("-")
else:
return "Error: Operator must be '+' or '-'."
#iterate the list within the list
for problem in range (len(problems)):
if problems[problem][0].isdigit() == False:
return "Error Numbers must only contain digits."
elif problems[problem][1].isdigit() == False:
return "Error Numbers must only contain digits."
#check if each number is more than four digits
for problem in range (len(problems)):
if len(problems[problems][0]) > 4:
return "Error: Numbers cannot be more than four digits."
elif len(problems[problems][1]) > 4:
return "Error: Numbers cannot be more than four digits."
sum = ""
if (operator == "+"):
sum = str(int(firstNumber) + int(secondNumber))
elif(operator == "-"):
sum = str(int(firstNumber) - int(secondNumber))
length = max(len(firstNumber), len(secondNumber))
top = str(firstNumber.rjust(length)
bottom = operator + str(secondNumber).rjust(length - 1)
line = ""
res = str(sumfirst s in range(length)
for s in range(length):
line += "-"
if problem != problems[-1]:
first += top + ' '
second += bottom + ' '
lines += line + ' '
sumx += res + ' '
else:
first += top
second += bottom
lines += line
sumx += res
return arranged_problems
```

**Your browser information:**

User Agent is: `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36`

.

**Challenge:** Arithmetic Formatter

**Link to the challenge:**