Budget App - Dreaded spacing issue with chart - at wit's end :(

undeleted - I fixed something, then realized I’m still stuck. From what I can tell from the error (I think?)… it doesn’t like that there isn’t an “o” at the 60% mark for clothing? But that wouldn’t be right as it’s supposed to be at 50%. As far as I can tell, my spacing is spot on. It’s 14 characters per row- my dashes are good, my “bars” are good, straight down the line? Any way, still appreciate any help…


-Original post:

Hello everyone! I’m right at the tail end of this project and I don’t know if I’m just too tired to figure this out myself (haha!) or am just reeeeeally stuck. I’m leaning towards reeeeally stuck… Everything “seems” to print out fine for me in PyCharm, but on Replit, it’s throwing an AssertionError for spacing. I would deeply appreciate any help.

Here’s the link to my repl: Repl link to joyb0218 - budget app

Thank you for your help!

Hi, good to know you got some progress (I was in the middle of replying when you deleted it first xD)
So let’s look at the error with some better spacing:

AssertionError:
'Perc[77 chars]|          \n 60|          \n 50|          \n [299 chars]  \n'
!=
'Perc[77 chars]|    o     \n 60|    o     \n 50|    o     \n [297 chars] t  '

So it’s expecting you to have higher bars and also the bar is in the middle.
We could look at the “test_create_spend_chart” in the testing module to see the exact inputs, though the list printed in the console (not copied) already gives us some valuable insight.

I mean, for a start your bar-chart does not add up to 100%, so there is clearly a math error. Also keep in mind the test expects you to always round up → so 61% would be rounded to 70%.
Then with the bar expected in the middle, you propably sort the values, which you are not supposed to do. You gonna take them and display them in the order they were withdrawn.

1 Like

Hi Jagaya! Sorry about that! :smiley: :smiley: :smiley:

The instructions state, “The height of each bar should be rounded down to the nearest 10.”

And… the test parameters are rounding up? Like, 51% needs to round “up” to 60%? That would be a little weird?

Also, I did sort the values, but it’s only failing the space issue?

In any event, I’ll round up and see how that works. Thanks for your help, it’s extremely appreciated!

Ah damnit, mixed them up >.<
Ignore what I said.
Ok so 68% would be 60%… well if I am not mistaken, with 3 bars your chart should add up to at least 80% (because there is no constellation to round down 30 points).
But in the error message, it’s only 50% - so there is a problem with the calculation.

Sorting caused the bars to be in different orders.
If you look at the error I posted, the distance inbetween the percent is correct (no spacing issue) however the placement of the “o” is wrong.

1 Like

Ah damnit, mixed them up >.<

Haha! No worries!

Thanks for pointing me in the right direction. I’m going to attempt to get the placement straightened out. Wish me luck! :smiley:

1 Like

***I figured out what the problem is! And yes, my math was off! ***

1 Like

@Jagaya !!

Screenshot 2021-12-30 174631

I’m sooooooooo excited!!! Thank you for your help today!!!

:star_struck: :star_struck: :star_struck: :star_struck:

1 Like

Good job and well done ^^
I’m glad I could help.

1 Like

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