Python Budget App issue

Hello Everyone, hope you are all well. I am trying to complete the ‘Budget app’ problem but I am encountering some issues. I am not sure where I have gone wrong. All tests pass except the last one, from line 102:
‘self.assertEqual(actual, expected, ‘Expected different chart representation. Check that all spacing is exact.’)’

Here is my code (sorry, it’s a mess), any help would be greatly appreciated:

boilerplate-budget-app (10) - Replit
It’s in the

From the spec:

Besides the Category class, create a function (outside of the class) called create_spend_chart that takes a list of categories as an argument. It should return a string that is a bar chart.

Your create_spend_chart does not have a return that I can find, so it returns None and the test produces the error you are seeing.

1 Like

Thanks Jeremy. I have fixed the issue but it still doesn’t quite work.
Here is my code:

Between line 93 and 100 in the test module, the default values inputted results in a different graph output. The default values were (Food [+900 deposit, - 155 withdraw], Business [+900 deposit, -30 withdraw], and Entertainment [ +900 deposit, -50 withdraw]).

When my code was ran, these values result in my graph having a percentage of 30% for each category, which I think is correct.
However, the expected graph is distributed as 0%, 70%, and 20%, I do not know where these values come from.

Thanks again your time.

boilerplate-budget-app (11) - Replit

1 Like

I am having the exact same issue, which makes me believe it is not just a coincidence, it is hard to actually search through the and figure out what values led them to the 0%, 70%, 20% answer…

I have some issue with the spaces in the create spend chart, but I don’t get the error message and offline the output seems to be fine.

Can someone help me with this issue?

Output offline:

Thanks Randell, I’ll look into this.

I am also having this specific issue. The expected 0%,70%,20% graph does not match the test module lines.

5 posts were split to a new topic: Python Budget App issue