```
def arithmetic_arranger(problems, show = False):
if len(problems) > 5:
return "Error: Too many problems."
def checkOperator(stringOperator):
if stringOperator in ('-','+'): return True
def checkDigit(stringDigit):
if stringDigit.isdigit(): return True
def checkLen(stringOperand):
if len(stringOperand) <= 4: return True
answer = ""
fourWS = " "*4
for operations in problems:#1st line
currOperation = operations.split(' ') #[0] => first number [1] => operator [2] => last number
maxSize = max(len(currOperation[0]), len(currOperation[2])) + 2
if not checkOperator(currOperation[1]):
return "Error: Operator must be '+' or '-'."
if not (checkDigit(currOperation[0]) and checkDigit(currOperation[2])):
return "Error: Numbers must only contain digits."
if not (checkLen(currOperation[0]) and checkLen(currOperation[2])):
return "Error: Numbers cannot be more than four digits."
answer += currOperation[0].rjust(maxSize) + fourWS
answer.rstrip()
answer += "\n"
for operations in problems:#2nd line
currOperation = operations.split(' ') #[0] => first number [1] => operator [2] => last number
maxSize = max(len(currOperation[0]), len(currOperation[2])) + 1
answer += currOperation[1] + " " + currOperation[2].rjust(maxSize - 1) + fourWS
answer.rstrip()
answer += "\n"
for operations in problems:#3rd line
currOperation = operations.split(' ') #[0] => first number [1] => operator [2] => last number
maxSize = max(len(currOperation[0]), len(currOperation[2])) + 2
separator = maxSize * "-"
answer += separator+fourWS
answer.rstrip()
answer += "\n"
if show == True:
for operations in problems:#4th line
currOperation = operations.split(' ') #[0] => first number [1] => operator [2] => last number
maxSize = max(len(currOperation[0]), len(currOperation[2])) + 2
if currOperation[1] == '+':
result = str(int(currOperation[0]) + int(currOperation[2]))
else:
result = str(int(currOperation[0]) - int(currOperation[2]))
answer += result.rjust(maxSize)+fourWS
answer.rstrip()
return answer
```

This is my function, and it when I try to run it through the tests it always fails the normal tests (those that don’t check for incorrect operators, letters instead of numbers etc)

I don’t understand why and I have been stuck on this for a while and it’s just frustrating because my output looks like what’s desired.