Spacing Issue with Budget App project - Python

I have no idea why freecodecamp is so adamant on spacing in such project when outcome is what matters the most. My output at a glance matches whats expected, however I’m getting an error

Percentage spent by category
 30|    o  o 
 20| o  o  o 
 10| o  o  o 
  0| o  o  o 
     F  C  A 
     o  l  u 
     o  o  t 
     d  t  o 
FAIL: test_create_spend_chart (test_module.UnitTests)
Traceback (most recent call last):
  File "/home/runner/boilerplate-budget-app/", line 101, in test_create_spend_chart
    self.assertEqual(actual, expected, 'Expected different chart representation. Check that all spacing is exact.')
AssertionError: 'Perc[34 chars]     \n 90|         \n 80|         \n 70|     [322 chars]    ' != 'Perc[34 chars]      \n 90|          \n 80|          \n 70|  [340 chars] t  '
Diff is 1303 characters long. Set self.maxDiff to None to see it. : Expected different chart representation. Check that all spacing is exact.

Ran 11 tests in 0.064s

FAILED (failures=1)

I have a request to freecodecamp to remove such spacing requirements in test, since I think everything in here has a practical sense except this one requirement.

Hello there,

Keep in mind, it is not freeCodeCamp that is so adamant on spacing - it is programming. Programs only do what you tell them to do. So, you have to be extremely explicit.

If a client asked you to do 1 - 12 and you did 0.99999 - 11.999999, did you do what was asked?

The point of the freeCodeCamp certification projects is for you to follow user stories. If you do not want to, that is fine (in the context of what you wanted to accomplish), but then you are deliberately not following the given specification.

Hope this clarifies

1 Like


I get it now man that we need to be specific while programming. It took me a week to reach the output and I admit I didn’t bother much about the specifics such as spaces.

Could you help me out in reducing the spaces though, somehow I’m not able to get it down to the required count without changing the core code.

Also thanks for the clarification.

Would you mind sharing a link to your project?


Shaun, I figured it out. Thanks for offering help though, appreciate it.

1 Like

That’s just completly backwards…
FCC is not adamant - FCC provides a string as to how the result should look.
They are not humans looking at the result, they provided code to automatically test it. The moment they would want to include several “good looking” solutions, they’d need to write a hell of a lot of code, alternative test-cases and constantly update it in case someone finds a new “good looking” solutions that wasn’t included before. Because obviously some spaces are vital, others are not - so that’s like what? A 500 character regeular-expression because people might be to lazy to get rid of some spaces?

If you work on a job and get hired to produce a certain output - you cannot write something that “looks right” and then just hope that whoever is later working with the output takes the time to identify how much your “looks right” might be different from the actual task given.

And that is the main thing: if you don’t do the additional work, then people down the line will have to do 10 times as much to deal with your error :wink:
Even when you yourself start working on larger projects, you’ll quickly notice that everything you have to fix later on, will cause much more trouble and consume much more time, than if you had thought about it beforehand and avoided the mistake.

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