**Tell us what’s happening:**

Every time I run the code on replit it tells me I have errors in the console. I can gather that it probably has something to do with the spacing given the shows an assert statement where the two strings are not equivalent. I’m just not sure how to read the output from pytest. How can I tell the difference between what the expected output is and the output my program is giving?

**Error Message from Pytest**

```
arguments = [['3801 - 2', '123 + 49']], expected_output = ' 3801 123\n- 2 + 49\n------ -----'
fail_message = 'Expected different output when calling "arithmetic_arranger()" with ["3801 - 2", "123 + 49"]'
@pytest.mark.parametrize('arguments,expected_output,fail_message', test_cases)
def test_template(arguments, expected_output, fail_message):
actual = arithmetic_arranger(*arguments)
> assert actual == expected_output, fail_message
E AssertionError: Expected different output when calling "arithmetic_arranger()" with ["3801 - 2", "123 + 49"]
E assert ' 3801 123\n- 2 + 49\n----- ----' == ' 3801 123\n- 2 + 49\n------ -----'
E - 3801 123
E ? - -
E + 3801 123
E - - 2 + 49
E ? - -
E + - 2 + 49
E - ------ -----
E ? - -
E + ----- ----
test_module.py:77: AssertionError
```

**My Code**

```
def arithmetic_arranger(problems, show_answers=False):
arranged_problems = ''
invalid_operators = ['*', '/', r'//']
problem_limit = 5
digit_limit = 4
top_lines = []
bottom_lines = []
under_lines = []
answers = []
# check if we are over the problem limit
if len(problems) > problem_limit:
return "Error: Too many problems."
# split the problems up and check formatting errors
for problem in problems:
terms = problem.split()
if len(terms[0]) > digit_limit or len(terms[2]) > digit_limit:
return "Error: Numbers cannot be more than four digits."
if terms[1] in invalid_operators:
return "Error: Operator must be '+' or '-'."
# check if both operands are only digits
try:
term_1 = int(terms[0])
term_2 = int(terms[2])
except ValueError:
return "Error: Numbers must only contain digits."
if terms[1] == '+':
answer = term_1 + term_2
else:
answer = term_1 - term_2
# properly formatting string
line_length = max(len(terms[0]), len(terms[2])) + 1
top_line = terms[0].rjust(line_length)
if len(terms[2]) == max(len(terms[0]), len(terms[2])):
bottom_line = (terms[1] + " ") + (terms[2].rjust(line_length -1))
else:
bottom_line = (terms[1]) + (terms[2].rjust(line_length -1))
solution = str(answer).rjust(line_length)
under_line = "-" * line_length
# put each line into an array for mass formatting
top_lines.append(top_line)
bottom_lines.append(bottom_line)
under_lines.append(under_line)
answers.append(solution)
final_top_line = (" ").join(top_lines)
final_bottom_line = (" ").join(bottom_lines)
final_under_lines = (" ").join(under_lines)
final_answers = (" ").join(answers)
if show_answers:
arranged_problems = ("\n").join([final_top_line, final_bottom_line, final_under_lines, final_answers])
else:
arranged_problems = ("\n").join([final_top_line, final_bottom_line, final_under_lines])
return arranged_problems
```

**Your browser information:**

User Agent is: `Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/117.0`

**Challenge:** Scientific Computing with Python Projects - Arithmetic Formatter

**Link to the challenge:**