Build a Budget App Project - Build a Budget App Project

Tell us what’s happening:

My create_spend_chart seems to return similar output as the example provided, but I can’t seem to pass the test, can anyone tell me what i may be missing. Here is screenshot of part of my console

Your code so far


Your browser information:

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

Challenge Information:

Build a Budget App Project - Build a Budget App Project

The assertion error and diff gives you a lot of information to track down a problem. For example:

AssertionError: 'Year' != 'Years'
- Year
+ Years
?     +

Your output comes first, and the output that the test expects is second.

AssertionError: ‘Year’ != ‘Years’

Your output: Year does not equal what’s expected: Years

This is called a diff, and it shows you the differences between two files or blocks of code:

- Year
+ Years
?     +

- Dash indicates the incorrect output
+ Plus shows what it should be
? The Question mark line indicates the place of the character that’s different between the two lines. Here a + is placed under the missing s .

Here’s another example:

E       AssertionError: Expected different output when calling "arithmetic_arranger()" with ["3801 - 2", "123 + 49"]
E       assert '  3801      123    \n   - 2     + 49    \n------    -----    \n' == '  3801      123\n-    2    +  49\n------    -----'
E         -   3801      123
E         +   3801      123    
E         ?                ++++
E         - -    2    +  49
E         +    - 2     + 49    
E         - ------    -----
E         + ------    -----    
E         ?                +++++

The first line is long, and it helps to view it as 2 lines in fixed width characters, so you can compare it character by character:

'  3801      123    \n   - 2     + 49    \n------    -----    \n'
'  3801      123\n-    2    +  49\n------    -----'

Again, your output is first and the expected output is second. Here it’s easy to see extra spaces or \n characters.

E         -   3801      123
E         +   3801      123    
E         ?                ++++

Here the ? line indicates 4 extra spaces at the end of a line using four + symbols. Spaces are a little difficult to see this way, so it’s useful to use both formats together.

I hope this helps interpret your error!

your graph has the bars of the wrong height, check your calculations, double check what the instructions say about calculating the percentages

post your code for more help

thanks, I will check

I used percentSpend = totalExpenses / totalDeposit * 100

this is my code https://github.com/Sirvinlex/freecodecamp-project-note-files/blob/main/scientific-computation-with-python-note-files/budget-app.py

I can post the full code here if you want

Double check the instructions:

The percentage spent should be calculated only with withdrawals and not with deposits.

thanks for the reply, but I’m having some confusion here, for example if total expenses is 76, how do I get the percentage spent without total deposit

you use the single category expenses over the total expenses of all the categories

thanks, I will try that