Arithmetic Arranger Python

Good day everyone,

My code produce exactly the same (Visual) output in the Repl Console. But all the unit tests fail.

For example if I copy my output to Notepadd++ and compare to what the test expects it is exactly the same.

Please advise - maybe I am missing something. But all tests are failing.

Unit Test Expects:

’ 3801 123\n’
‘- 2 + 49\n’
‘------ -----’,

My Output:

’ 3801 123\n’
‘- 2 + 49\n’
‘------ -----’,

Appreciate any help. I may be missing something here :slight_smile:

Please provide a link to your replit, as the unittests there will tell you exactly where you are wrong.
But given you refer to the console - you sure you are returning strings and not just printing stuff?

I am returning from the function and then in the main file the function gets called with a print() statement. But that was the project template/stub

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

Another issue is when I want to concatenate the 4 spaces it does not do it. When debugging there is only one space between the problems.

:slight_smile:

Don’t comment out the test-cases, those are important ^^°
Anyway, this line will cause some problem:
arranged_problems = line1 + "\n" + line2 + "\n" + line3 + "\n" + line4
You add a “\n” at the end, even if line4 is empty.

2 Likes

Thank you so much! Solved my challenge.