Scientific Computing with Python Projects - Arithmetic Formatter

Tell us what’s happening:
For some reason on my pyCharm the code is Working fine and passing the tests, but on replit the output is differnt

Your project link(s)

solution: boilerplate-arithmetic-formatter (1) - Replit

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36 Edg/108.0.1462.54

Challenge: Scientific Computing with Python Projects - Arithmetic Formatter

Link to the challenge:

Please post the output here.

for arithmetic_arranger([‘3801 - 2’, ‘123 + 49’], True)
i am getting

3801      123    
-         2    +  49    
  ------       -----    
  3799      172

i edited your post to make it more readable.

I’m not sure if you are asking for help with the code or if you are trying to understand something else?
There is no reason for the code to behave differently on replit than anywhere else.
(unless you changed it)

Sorry for the confusion, can you tell me what is wrong with my code?

according to the tests, there is multiple issues in the code.
One of the tests for eg. shows this:

>   ???
E   AssertionError: Expected different output when calling "arithmetic_arranger()" with ["1 + 2", "1 - 9380"]
E   assert '  1         1    \n+ 2    - 9380    \n---    ------    ' == '  1         1\n+ 2    - 9380\n---    ------'
E     -   1         1
E     +   1         1    
E     ?              ++++
E     - + 2    - 9380
E     + + 2    - 9380    
E     ?              ++++
E     - ---    ------
E     + ---    ------    
E     ?              ++++

and this means that you have extra spaces at the end of each line (that’s what the ++++ is saying. There is an additional 4 spaces being added to each line being printed).

So try to see why that is.

Another issue:
You are raising Exceptions instead of returning error messages.
The test just wants plain string error messages.

Try to work on these two.

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