Help arithmetic formatter

Hi All, i have been trying to figure out why i am getting these failures on this test. I have ran the code i wrote on VScode and jupyter notebook and everything seems to be working alright. But when i run the units, i got 2failures. Please could anyone help.

Here is my code link.

Thanks in advance for taking a look

There’s no way to debug this from screenshots. Create a of the project and post a link and you’re more likely to get help.

In general, post links to projects or include code/errors in code blocks in your post.

1 Like

Thanks for your kind response. I have updated the post to include project link.

The error:

E   AssertionError: Expected solutions to be correctly displayed in output when calling "arithmetic_arranger()" with five arithmetic problems and a second argument of `True`.
E   assert '   32       ... 172     1028' == '   32       ... 172     1028'
E          32         1      45      123      988
E       - 698    - 3801    + 43    +  49    +  40
E       -----    ------    ----    -----    -----
E     -  -666     -3800      88      172     1028
E     ? -
E     + -666     -3800      88      172     1028

In this case, the + line is your code and the - line is what is expected. So somewhere you’re missing a space from the beginning of your answer line. Looking at all the answer occurrences in your code and I find that one of these things is not like the others:

        if answer == True:
            arranged_problems = top_case.rstrip() + '\n' + down_case.rstrip(
            ) + '\n' + dashes.rstrip() + '\n' + ans.strip()

Many thanks for your insight. It’s been very helpful :pray:t4:

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