Scientific Computing with Python Projects - Arithmetic Formatter

Hi, I am working on a certification challenge where I have to build a Arithmetic Formatter. I have met all the requirements as shown in this page, but the pytest says that I have only passed 3 tests and failed the rest of the 7 tests. My code is right here: Arithmetic Formatter. Can someone please help me?

      print("Error: Numbers must only contain digits.")

You must return errors, not print them.

-   3801      123
+   3801      123    
?                ++++
- -    2    +  49
+ -    2    +  49    
?                ++++
- ------    -----
+ ------    -----    
?                +++++

This is saying that you addded (+) 4-5 extra spaces at the end of each line.

1 Like

Hi JeremyLT,
Thanks for the short reply. I accidentally printed an error instead of returning it. Sorry about that. I do not understand what you mean by “This is saying that you added (+) 4-5 extra spaces at the end of each line.” Could you please explain it to me? Thanks.

The + indicates characters that are in your output that the tests don’t want. You have four spaces at the end of each line.

Thank you so much, JeremyLT, it helped a lot. Thanks!

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