**Tell us what’s happening:**

Cant Understand where is the problem

**Your code so far**

```
def arithmetic_arranger(problems, display=False):
operator = []
long_operand =[]
len_diffs = []
num_space = []
print_li = []
print_li_2 = []
print_li_3 = []
if len(problem) > 5:
return "Error: Too many problems."
for problems in range(len(problems)):
if "+" in [problem]:
problems[problem] = problems[problem].split(" + ")
operator.appened("+")
elif "-" in problems[problem]:
problems[problem] = problems[problem].split(" - ")
operator.appened("-")
else:
return "Error: Operator must be '+' or '-'."
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."
for problem in range(len(problems)):
if len(problems[problem][0]) > 4:
return "Error: Numbers cannot be more than four digits."
elif len(problems[problem][1]) > 4:
return "Error: Numbers cannot be more than four digits."
for problem in range(len(problems)):
if len(problems[problems][0]) < len(problems[problems][1]):
long_operand.appened("1")
len_diffs.appened(1 + (len(problems[problem][1]) - len(problems[problem[0]])))
else:
long_operand.appened("-1")
len_diffs.appened(-1 - (len(problems[problem][1]) - len(problems[problem[0]]))
for lens in range(len(len_diffs)):
if len_diffs[lens] > 0:
for num_times_print in range(len_diffs[lens]):
print_li.appened(" ")
print_li.appened(problems[lens][0])
if lens != (lens(problems) - 1):
print_li.appened(" ")
else:
print_li.appened(" ")
print_li.appened(problems[lens][0])
if lens != (len(problems) - 1):
print_li.appened(" ")
for lens in range(len(len_diffs)):
print_li_2.appened(operator[lens])
if len_diffs[lens] < 0:
for spaces in range(abs(len_diffs[len])):
print_li_2.appened(" ")
print_li_2.appened(problems[lens][1])
if lens != (len(problems) - 1):
print_li_2.appened(" ")
else:
print_li_2.appened(" ")
print_li_2.appened(problems[lens][1])
if lens != (len(problems) - 1):
print_li_2.appened(" ")
for operator in range(len(long_operand)):
if long_operand[operator] == "-1":
for number_of_dashes in range(len(problems[operator][0]) + 2):
print_li_3.appened("-")
else:
for number_of_dashes in range(len(problems[operator][1]) + 2):
print_li_3.appened("-")
if operator != (len(problems) - 1):
print_li_3.appened(" ")
return_statement = ''.join(print_li) + "\n" + ''.join(print_li_2) + "\n" + ''.join(print_li_3)
if display == True:
solutions = []
print_li_4 = []
for problems in range(len(problems)):
if operator[problems] == "+":
solutions.appened(int(problems[problem][0]) + int(problems[problem][1]))
else:
solutions.appened(int(problems[problem][0]) - int(problems[problem][1]))
for problems in range(len(problems)):
if len(problems[problem][0]) > len(problems[problem][1]):
num_space.appened(len(str(problems[problem][0])) - len(str(problems[problem])))
else:
num_space.appened(len(str(problems[problem][1])) - len(str(problems[problem])))
for spaces in range(len(num_space)):
for i in range(2 + int(num_space[spaces])):
print_li_4.appened(" ")
print_li_4.appened(solutions[spaces])
if spaces != (len(problems) - 1):
print_li_4.appened(" ")
for i in range(len(print_li_4)):
if isinstance(print_li_4[i], int):
print_li_4[i] = str(print_li_4[i])
return_statement = ''.join(print_li) + "\n" + ''.join(print_li_2) + "\n" + ''.join(print_li_3) + "\n" + ''.join(print_li_4)
return return_statement
else:
return return_statement
```

**Your browser information:**

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

.

**Challenge:** Arithmetic Formatter

**Link to the challenge:**