Python Budget app integer spacing not passing test

After lengthy search on freecodeCamp forum, Stackoverflow , Youtube chrome. I put together the recent version of my Scientific computing with Python Budget App.
There is still issues with the following parts of the create spend chart.

  1. I cant seem to get the integer’s (100 to 0) to space out correctly.
  2. My longest string of the categories does not match the correct spacing for entertainment’s “t”
    Here is my Budget App Link

Does it help to look at it this way:

'Perc[35 chars]       \n 90|            \n 80|            \n [365 chars]  \n'
'Perc[35 chars]     \n 90|          \n 80|          \n 70|   [339 chars] t  '

First line is your output. Second line is the expected output. You can see you have 2 extra spaces at the end of your lines.

I fixed the second issue with rstrip method newline. But cannot figure out how to remove spaces between integers in chart.

Look at your test chart, spacing is fine. You can see this from the test output:

'Perc[77 chars]|          \n 60|       o  \n 50|       o  \n [297 chars] t  '
'Perc[77 chars]|    o     \n 60|    o     \n 50|    o     \n [297 chars] t  '

Spacing is good, you can see this because 60 and 50 align. The ‘o’ is in the wrong place. You have no ‘o’ for 60% but the expected result does.

The problem is that your numbers are wrong. This problem is worded very strangely, and maybe does not make sense for a budget app but:

“The chart should show the percentage spent in each category passed in to the function. The percentage spent should be calculated only with withdrawals and not with deposits.”

Add up all the withdraws of all the categories together, that’s total spending. Then what percent of that was spent in each category?

*************Food*************
initial deposit        1000.00
groceries               -10.15
restaurant and more foo -15.89
Transfer to Clothing    -50.00
Total: 923.96
***********Clothing***********
Transfer from Food       50.00
                        -25.55
Total: 24.45
*************Auto*************
initial deposit        1000.00
                        -15.00

Auto you spent the least, $15.

Percentage spent by category
100|          
 90|          
 80|          
 70|          
 60|       o  
 50|       o  
 40|       o  
 30|       o  
 20|    o  o  
 10| o  o  o  
  0| o  o  o  
    ----------
     F  C  A  
     o  l  u  
     o  o  t  
     d  t  o  
        h     
        i     
        n     
        g     

But here Auto is 60% of spending.

Thank you. I finally finished budget app project. It took me a while watching Youtube video and doing research on getting percentage of the over all amount of with drawls for current category. I read the following article on wikihow(https://www.wikihow.com/Calculate-Percentages) to understand what I am supposed to do with with drawls ledger. Here is my final version (https://replit.com/@Ajax401/boilerplate-budget-app#budget.py) of the project al tests passing. I had issues with spacing at the end of vertical categories in graph and had to add space before newline in creating vertical lines in for in zip_longest loop. As well as add a new line to rstrip method to correctly space categories.

1 Like

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