Budget App - Project in Python Scientific Computing

Tell us what’s happening:
Describe your issue in detail here.
I am getting one failure “Expected different chart representation. Check that all spacing is exact” while running this program.

All the trailing spaces were removed. I can’t figure out exactly where the spacing is incorrect. The output while running the same code in a separate IDE (pyCharm / VS Code) seems to show the result as expected. But on Replit.com as per the test case, the output is showing duplicate values on the bar chart ( left side plot (0-100), bars & category names are all duplicated).

Please advise!

Your code so far

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36

Challenge: Budget App

Link to the challenge:

Please post a link to your code.
Removing “all” trailing spaces could be an issue here, as for the spent-chart each line is supposed to have the same length → meaning it actualy requires trailing spaces.

Please find the link to the code on Replit.com.
boilerplate-budget-app-1 - Replit

As you did specify, i am now allowing the trailing spaces while plotting the bar. But it still shows the same error, I guess because of spacing issues that I can’t figure out.

Here is the error:

-  10| o  o  o  
?            ---
+  10|    o  o  
?      +++
    0| o  o  o  
      ----------
-      B  F  E
+      B  F  E  
?             ++
-      u  o  n
+      u  o  n  
?             ++

Red is your output, Green is expected, Questionmark indicates differences.
So the categories at the bottom are missing spaces, and the bars are slightly wrong. Maybe you are not properly rounding down?

Jagaya, your feedback towards my output errors were spot on. The categories in the chart are now displayed properly. As you pointed out, i added the trailing spaces towards the end and that worked.

As for the bars, I need your clarification on the below situation.

As per the Test Case:
food.withdraw(105.55), entertainment.withdraw(33.40), business.withdraw(10.99)
Total Withdrawal : 149.94

Percentage Spent by Category (Business) = 10.99 / 149.94 which gives 7.32 % and when rounded to the nearest 10 is 10. That is plotted in my chart (for Business) but as per the test case, the expected result for Business is 0. Please confirm on this.

That’s a bit irritating but the task specifically asks for “rounded DOWN to the nearest 10” → so 7.32% ~ 0% :wink:

Oh yeah, I wasn’t expecting that but will make the changes accordingly. But before that, please reconfirm that as per this task (to be rounded down means), anything btw 0 and 9.99 would be 0 , btw 10 and 19.99 would be 10 and so on…

That is correct.
This also means the sum of all percentage for the test cases will end up being less than 100%.

Thank you for the support. Your explanation is very clear.