Tell us what’s happening:
I don’t understand where test 16 is failing. The test name is very vague, and with the test data in the story it prints what’s expected (actually, the story sample code and sample output don’t match up).
I checked the browser console and I’m only seeing test failures relating to the spend chart.
Your code so far
class Category:
def __init__(self, name):
self.name = name
self.ledger = []
def __str__(self):
string = self.name
star_length = int((30 - len(self.name))/2)
stars = '*' * star_length
string = stars + string + stars
if (30 - len(self.name)) % 2 != 0:
string += '*'
string += ('\n')
for l in self.ledger:
desc_trunc = l['description'][:23]
string += desc_trunc
#print('> ', string)
amt = str(round(l['amount'], 2))
string += ' ' * (30 - len(desc_trunc))
if len(amt) <= 7:
string = string[:-len(amt)] + amt
string += '\n'
string += f'Total: {self.get_balance()}'
return string
def check_funds(self, amount):
if amount > self.get_balance():
#print('check_funds insuff funds', amount, self.get_balance())
return False
else:
#print('check_funds sufficient')
return True
def get_balance(self):
balance = 0
#print('led', self.ledger)
for l in self.ledger:
# print('l', type(l), l, l['amount'])
balance += l['amount']
#print('bal', balance)
return balance
def deposit(self, amount, description=''):
#print('in deposit: ', self.ledger)
self.ledger.append(dict({'amount': float(amount), 'description': description}))
#print('help', self.ledger, amount, description)
def withdraw(self, amount, description=''):
if self.check_funds(amount):
if amount > 0:
amount = amount * -1
self.deposit(amount, description)
#print(f'withdraw {amount} ok')
return True
else:
#print(f'withdraw {amount} fail insuff')
return False
def transfer(self, amount, destination):
if self.check_funds(amount):
self.withdraw(amount, f'Transfer to {destination.name}')
destination.deposit(amount, f'Transfer from {self.name}')
return True
else:
print('failed transfer')
return False
def create_spend_chart(categories):
pass
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:147.0) Gecko/20100101 Firefox/147.0
Challenge Information:
Build a Budget App - Build a Budget App
Failures from console:
EE python-test-evaluator.js:2:12859
====================================================================== python-test-evaluator.js:2:12859
ERROR: test_create_spend_chart_names_three_categories (test_module.UnitTests.test_create_spend_chart_names_three_categories) python-test-evaluator.js:2:12859
---------------------------------------------------------------------- python-test-evaluator.js:2:12859
Traceback (most recent call last): python-test-evaluator.js:2:12859
File "/home/pyodide/test_module.py", line 28, in test_create_spend_chart_names_three_categories python-test-evaluator.js:2:12859
actual = "\n".join(chart.split("\n")[13:]).rstrip("\n") python-test-evaluator.js:2:12859
^^^^^^^^^^^ python-test-evaluator.js:2:12859
AttributeError: 'NoneType' object has no attribute 'split' python-test-evaluator.js:2:12859
<empty string> python-test-evaluator.js:2:12859
====================================================================== python-test-evaluator.js:2:12859
ERROR: test_create_spend_chart_names_two_categories (test_module.UnitTests.test_create_spend_chart_names_two_categories) python-test-evaluator.js:2:12859
---------------------------------------------------------------------- python-test-evaluator.js:2:12859
Traceback (most recent call last): python-test-evaluator.js:2:12859
File "/home/pyodide/test_module.py", line 22, in test_create_spend_chart_names_two_categories python-test-evaluator.js:2:12859
actual = "\n".join(chart.split("\n")[13:]).rstrip("\n") python-test-evaluator.js:2:12859
^^^^^^^^^^^ python-test-evaluator.js:2:12859
AttributeError: 'NoneType' object has no attribute 'split' python-test-evaluator.js:2:12859
<empty string> python-test-evaluator.js:2:12859
---------------------------------------------------------------------- python-test-evaluator.js:2:12859
Ran 2 tests in 0.000s python-test-evaluator.js:2:12859
<empty string> python-test-evaluator.js:2:12859
FAILED (errors=2) python-test-evaluator.js:2:12859
Object { message: "Unspecified AssertionError", showDiff: false, actual: null, expected: undefined }
python-test-evaluator.js:2:158899
F python-test-evaluator.js:2:12859
====================================================================== python-test-evaluator.js:2:12859
FAIL: test_create_spend_chart (test_module.UnitTests.test_create_spend_chart) python-test-evaluator.js:2:12859
---------------------------------------------------------------------- python-test-evaluator.js:2:12859
Traceback (most recent call last): python-test-evaluator.js:2:12859
File "/home/pyodide/test_module.py", line 23, in test_create_spend_chart python-test-evaluator.js:2:12859
self.assertEqual(actual, expected, 'Expected different chart representation. Check that all spacing is exact.') python-test-evaluator.js:2:12859
AssertionError: None != 'Percentage spent by category\n100| [384 chars] t ' : Expected different chart representation. Check that all spacing is exact. python-test-evaluator.js:2:12859
<empty string> python-test-evaluator.js:2:12859
---------------------------------------------------------------------- python-test-evaluator.js:2:12859
Ran 1 test in 0.001s python-test-evaluator.js:2:12859
<empty string> python-test-evaluator.js:2:12859
FAILED (failures=1) python-test-evaluator.js:2:12859
Object { message: "Unspecified AssertionError", showDiff: false, actual: null, expected: undefined }
python-test-evaluator.js:2:158899
Did you compare your output to the output in the example?
Your output:
*************Food*************
deposit 1000.0
groceries -10.15
restaurant and more foo -15.89
Transfer to Clothing -50.0
Total: 923.96
Does something look wrong with the number values?
ILM
February 13, 2026, 9:00pm
4
you should see also this in the console
AssertionError: '****[47 chars] 900.0\nmilk, cereal, eggs, bac -45.67\nT[40 chars]4.33'
!= '****[47 chars] 900.00\nmilk, cereal, eggs, bac -45.67\nT[40 chars]4.33'
the first line is your code, the second line is the expected
Thanks, now I see how mine is different.
BTW, the ‘example usage’ and ‘example output’ in the instructions don’t match up. (One says ‘deposit’, the other says ‘initial deposit’.)
ILM
February 16, 2026, 6:17pm
7
Thank you for helping make FCC better. Bugs can be reported as GitHub Issues . Whenever reporting a bug, please check first that there isn’t already an issue for it and provide as much detail as possible.