# Scientific Computing with Python Projects - Arithmetic Formatter

### Tell us what’s happening:

I have completed my code. I checked and it is providing what “Should Return” is asking. But, it does not pass the Test. How do I find out where it is wrong.

SS

``````def arithmetic_arranger(problems, show_answers=False):
number_of_problem = len(problems)

if  number_of_problem > 5:
print('Error: Too many problems.')
return

num1_list = []
num2_list = []
operator_list = []
max_len_list = []
result_list = []

for i in problems:
num1, operator, num2 = i.split()
num1_list.append(num1)
operator_list.append(operator)
num2_list.append(num2)
max_len = max(len(str(num1)), len(str(num2)))
max_len_list.append(max_len)

for i in operator_list:
if i != "-" and i != "+":
print("Error: Operator must be '+' or '-'.")
return

for i in num1_list:
digits = len(i)
if digits > 4:
print('Error: Numbers cannot be more than four digits.')
return

for i in num2_list:
digits = len(i)
if digits > 4:
print('Error: Numbers cannot be more than four digits.')
return

for i in problems:
num1, operator, num2 = i.split()
try:
result_list.append(eval(i))
except:
print('Error: Numbers must only contain digits.')
return

first_row_string = ""
second_row_string = ""
third_row_string = ""
fourth_row_string = ""
tab = " " * 4
for i in range(number_of_problem):
prefix = operator_list[i] + ' '

#first row creation
space_num1 = len(prefix) + max_len_list[i] - len(num1_list[i])
first_row_string += " "*space_num1 + str(num1_list[i]) + tab

#second row creation
space_num2 = max_len_list[i] - len(num2_list[i])
second_row_string += prefix + ' '*space_num2 + str(num2_list[i]) + tab

#third row creation
dash = max_len_list[i] + len(prefix)
third_row_string += '-'*dash + tab

#fourth row creation
space_result = len(prefix) + max_len_list[i] - len(str(result_list[i]))
fourth_row_string += ' '*space_result + str(result_list[i]) + tab

print(first_row_string[:-4] +'\n' + second_row_string[:-4] + '\n' + third_row_string[:-4] +'\n' + fourth_row_string[:-4])
else:
print(first_row_string[:-4] +'\n' + second_row_string[:-4] + '\n' + third_row_string[:-4])

``````

User Agent is: `Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36`

### Challenge Information:

Scientific Computing with Python Projects - Arithmetic Formatter