Scientific Computing with Python Projects - Arithmetic Formatter

what’s happening:
I’ve written a code that returns the desired outcome but it only manages to pass the error tests (didn’t do solutions part). Can someone guide me on what i am doing wrong or not doing properly.

code so far:

Link to the challenge:

1 Like

You need to add a second argument that has a default value of False.

You should put ‘Python argument default value’ into your search engine to find guides about this.

1 Like

Thanks for your response.

I added what you said and I’m still in the same situation. Maybe I didn’t explain what the problem was , I still haven’t done the part that is to show the results (line 4).
But everything else I’ve already done, including the arithmetic calculator syntax, but my code only passes the error tests, I can’t figure out what the error is that makes me not pass the tests that have to do with the position of the numbers

Where are you using the showResult variable inside of your function? I don’t see it.

Also, you are returning an empty string instead of the arranged problems.

1 Like

Thank you for responding.
I was writing code, when you respond, i was doing the last part of the exercise. I thing i fix what you said. I think its a problem with my output, when i print it out (line 81 and 85) it shows like it is supposed to, but fail the tests. Can you take a look again please?

Why are you adding showResult at the end of the output string?

Also, you don’t join strings with commas

assert (’ 3801 123 ', ‘\n’, '- 2 + 49 ', ‘\n’, '------ ----- ‘, ‘\n’, …) == ’ 3801 123\n- 2 + 49\n------ -----’

This line shows you what your output is and what the expected output is. I find it easier to anaylze like this:

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

These are raw strings. You can see you have some extra spaces, the extra commas should not be there. You have some random dots at the end of your string.

Your raw fstring should look exactly the same.

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