Could someone take a quick look at my arithmetic formater?

I’m currently passing 9/10 tests, but I am struggling to see what the issue is for the final test. When there were multiple failures I could look for patterns and figure out what to tweek. Now I’m down to Test 9 as the lone failure. It is a 2 problem test with answers displayed. The other 2 problem tests work. The other 5 problem test with answers displayed work. After staring at this for a few days, I need a fresh perspective to find a new angle.

boilerplate-arithmetic-formatter-2 - Replit

The error tells you everything:

E       AssertionError: Expected solutions to be correctly displayed in output when calling "arithmetic_arranger()" with ["3 + 855", "988 + 40"] and a second argument of `True`.
E       assert "Error: Opera...e '+' or '-'." == '    3      9... 858     1028'
E         + Error: Operator must be '+' or '-'.
E         -     3      988
E         - + 855    +  40
E         - -----    -----
E         -   858     1028

Your code (+ line) is flagging the input for an operator error when the test expects (- lines) the formatted problem. This means your test for the proper operators is wrong. The operators have to be either + or -; a problem set doesn’t have to contain both of them.

Thank you! I had been so focused on the “show answer” aspect I lost the tree in the forest. I appreciate your time and help.

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