Don't understand errormessage in freecodecamp python challenge

Hello,

https://replit.com/@benjamin222/boilerplate-arithmetic-formatter#arithmetic_arranger.py

hopefully you can see my code via the link. I really think my program works as intended but it gives to failures:

 python main.py
32 3801 45 123

  • 698 - 2 + 43 + 49

F…F…

FAIL: test_arrangement (test_module.UnitTests)

Traceback (most recent call last):
File “/home/runner/boilerplate-arithmetic-formatter/test_module.py”, line 14, in test_arrangement
self.assertEqual(actual, expected, ‘Expected different output when calling “arithmetic_arranger()” with [“11 + 4”, “3801 - 2999”, “1 + 2”, “123 + 49”, “1 - 9380”]’)
AssertionError: ’ 11[33 chars] 1\n- 4 - 2999 + 2 + 49 - 9380[37 chars]----’ != ’ 11[33 chars] 1\n+ 4 - 2999 + 2 + 49 - 9380[37 chars]----’
11 3801 1 123 1

    • 4 - 2999 + 2 + 49 - 9380
      ? --------
    • 4 - 2999 + 2 + 49 - 9380
      ? ++++++++
      ---- ------ — ----- ------ : Expected different output when calling “arithmetic_arranger()” with [“11 + 4”, “3801 - 2999”, “1 + 2”, “123 + 49”, “1 - 9380”]

======================================================================
FAIL: test_solutions (test_module.UnitTests)

Traceback (most recent call last):
File “/home/runner/boilerplate-arithmetic-formatter/test_module.py”, line 39, in test_solutions
self.assertEqual(actual, expected, ‘Expected solutions to be correctly displayed in output when calling “arithmetic_arranger()” with arithmetic problems and a second argument of True.’)
AssertionError: ’ 3[25 chars]123\n+ 698 - 3801 + 43 + 49\n----- [55 chars] 172’ != ’ 3[25 chars]123\n- 698 - 3801 + 43 + 49\n----- [55 chars] 172’
32 1 45 123

    • 698 - 3801 + 43 + 49
      ? ^
    • 698 - 3801 + 43 + 49
      ? ^

    -666 -3800 88 172 : Expected solutions to be correctly displayed in output when calling “arithmetic_arranger()” with arithmetic problems and a second argument of True.

Ran 6 tests in 0.009s

FAILED (failures=2)

Unfortunately I don’t understand the problem.

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.101 Safari/537.36 OPR/77.0.4054.90

Challenge: Arithmetic Formatter

Link to the challenge:

I think I got it myself. After a while these error messages do make some sense^^

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.