Budget App - Spend Chart Issues

Hi all, I have been working through the Python Projects and am almost finished with the Budget App. However, I keep failing the ‘test_create_spend_chart’ test. It seems that I have a spacing issue, but I am not sure where/how to find the issue. Any help or comments on my code would be greatly appreciated.

Here is the link to my code: https://replit.com/@UlmoME/boilerplate-budget-app#budget.py

** Update: Thanks to the tips I got, I was able to go through and fix the rounding and spacing on my chart, and my code is now working. Thanks, for your help guys!

Take a look at the example chart in README.md file and the chart that’s printed out after running main.py file. In the example first bar goes up to 60, and on chart returned from the function it’s up to 70.

2 Likes

This error is a bit hard to read given it’s not getting printed out, so let’s add some linebreaks:

AssertionError: 
'Perc[170 chars] 10| o  o  o  \n  0| o  o  o  \n    ----------[191 chars]  t '
!=
'Perc[170 chars] 10|    o  o  \n  0| o  o  o  \n    ----------[204 chars] t  '

Looking into the test_module.py the first line is your actual output and the second one is the expected output.
As it shows the first error, it means you got something at 10% that should be 0% (as it is rounded down - could be up to 9%). After that, there must be a spacing issue as your output is 13 characters shorter.

1 Like

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