# Program seems correct but testing fails

Tell us what’s happening:
Describe your issue in detail here.
I have already done the project and uplouded to git, all the outputs look like they are correct, but whenever I test it, all the tests but the 4th first are passed.

``````def arithmetic_arranger(problems, *boolean):
if bool(boolean):
calculate = True
else:
calculate = False

if len(problems) > 5:
return "Error: Too many problems."
line1 = ''
line2 = ''
line3 = ''
line4 = ''
for i in problems:
op = i.split()
if (op[1] != "+" and op[1] != "-"):
return "Error: Operator must be '+' or '-'."
if not (op[0].isdigit and op[2].isdigit()):
return "Error: Numbers must only contain digits."
if len(op[0]) >= 5 or len(op[2]) >= 5:
return "Error: Numbers cannot be more than four digits."
if len(op[0]) > len(op[2]):
aux = len(op[0])
line1 += ' '  * 2 + op[0] + ' '  * 4
line2 += op[1] + ' ' * (len(op[0])-len(op[2])+1) + op[2] + ' ' * 4
line3 += '-' * (len(op[0]) + 2) + " " * 4
else:
aux = len(op[2])
line1 += ' ' * 2 + ' ' * (len(op[2])-len(op[0])) + op[0] + ' ' * 4
line2 += op[1] + ' ' + op[2] + ' ' * 4
line3 += '-' * (len(op[2]) + 2) + ' ' * 4

if calculate:
if op[1] == '+':
result = int(op[0]) + int(op[2])
else:
result = int(op[0]) - int(op[2])
result = str(result)
line4 += " " * (aux + 2 - len(result)) + result + " " * 4

arranged_problems = line1[:-4] + '\n' + line2[:-4] + '\n' + line3[:-4] + '\n' + line4[:-4]
return arranged_problems
``````

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:97.0) Gecko/20100101 Firefox/97.0`

Challenge: Arithmetic Formatter

You can also use the “preformatted text” tool in the editor (`</>`) to add backticks around text.