**Tell us what’s happening:**

I have this code until now, it works on my IDE (VSC) but not at the testing unit, i’ve got 4 passes and 6 failded.

Should I change the format?

Thank you.

**Your code so far**

import re

def arithmetic_arranger(problems, show=False):

line1 = “”

line2 = “”

line3 = “”

results = “”

arranged_problems = “”

```
if (len(problems) > 5):
return "Error: Too many problems."
for eq in problems:
nums = re.findall("\d+", eq)
noDigit = re.findall("[^\d\s\+\-]", eq)
operators = re.findall("\s*(\+|\-)\s*", eq)
if (operators):
if (noDigit):
return "Error: Numbers must only contain digits."
elif (len(nums[0]) > 4 or len(nums[1]) > 4):
return "Error: Numbers cannot be more than four digits."
else:
result = int(nums[0]) + int(operators[0] + nums[1])
results += str(result) + " "
while len(nums[0]) != len(nums[1]):
if len(nums[0]) < len(nums[1]):
nums[0] = " " + nums[0]
elif len(nums[0]) > len(nums[1]):
nums[1] = " " + nums[1]
for x in nums[0]:
line3 += "-"
line3 += "-- "
line1 += " " + nums[0] + " "
line2 += operators[0] + " " + nums[1] + " "
else:
return "Error: Operator must be '+' or '-'."
line1 = re.sub("\s*$","",line1)
line2 = re.sub("\s*$","",line2)
line3 = re.sub("\s*$","",line3)
results = re.sub("\s*$","",results)
if show:
arranged_problems = line1 + "\n" + line2 + "\n" + line3 + "\n" + results
else:
arranged_problems = line1 + "\n" + line2 + "\n" + line3 + "\n"
return arranged_problems
```

**Your browser information:**

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36`

**Challenge:** Arithmetic Formatter

**Link to the challenge:**