Arithmetic_arranger looks good but fails

Hello after a week I can finally see the numbers print out as they should but I still have a lot of tests that I fail and I’m having a trouble to understand why from the console text.
it seems like they throw different stuff into the function and it fails but when I try to put the same numbers they used it prints good and still shows the test error message.

https://replit.com/@Rimidelo/boilerplate-arithmetic-formatter-3#arithmetic_arranger.py

I would like help to know which mistakes should I search for
Thanks!

Looking at the output

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

it looks like your spaces are all wrong.

1 Like

Hm ok i can see that but why in main.py the function output looks good but the spaces start to go wrong when the test start

If you mean the testcase you wrote into main.py, that doesn’t look good:

-    32      3801      45      123
+    32    3801      45     123    
- + 698    -    2    + 43    +  49
+ + 698    -  2    + 43    + 49    
- -----    ------    ----    -----
+ -----    ----    ----    ----

This is line by line your output (+) and the expected output (-) as given in the readme.
Got similar spacing issues. Note how each problem should be as long as the longest number+2 → instead it’s the second number+2, as can be seen in the second problem with only lengths 4 instead of the expected 6. Similar in the last problem with 4 instead of 5 [edit: meanwhile the first problem is correct with 5]

2 Likes

Thanks this helped! I looked again at the space value and saw that I accidently didn’t put the bracket in the right place.
I now have 8/10 of the tests clear, and just need to figure out why the operator and digit test are still bad

They are not :wink:
Your error message for wrong operators is missing quotation marks.

The other thing is because you didn’t properly place your tests → you actually cast the inputs to integer BEFORE checking .isnumeric().
So ofcourse if it is not numeric, you will run into an actual real error in Python, before your code comes around to catch it.

1 Like

Omg how did I miss that! Thanks man you helped a lot!
finally after a week I finished it now 4 more to go

1 Like

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