**Tell us what’s happening:**

Describe your issue in detail here.

I can’t understand what I have to calculate the percentage spent on, because if I calculate it on the deposit I get the wrong percentages and so I get the wrong chart.

For example the food object has 900 of deposit and 105 of spent so the percentage is about 11% but the test expected result have 70% and I don’t know where it came from.

**Your code so far**

class Category:

def **init**(self,cat):

self.CategoryName = cat

self.ledger =

def deposit(self,amount,description=’’):

self.ledger.append({‘amount’:amount,‘description’:description})

def withdraw(self,amount,description=’’):

if self.check_funds(amount):

self.ledger.append({‘amount’:-amount,‘description’:description})

return True

else:

return False

def get_balance(self):

if len(self.ledger)>0:

deposit = self.ledger[0][‘amount’]

spent = 0.00

for iter in range(1,len(self.ledger)):

spent-=float(self.ledger[iter][‘amount’])

return deposit - spent

else:

return 0

def transfer(self,amount,category):

state = self.withdraw(amount,f’Transfer to {category.CategoryName}’)

if not state:

return False

```
category.deposit(amount,f'Transfer from {self.CategoryName}')
return True
```

def check_funds(self,amount):

return self.get_balance()-amount >= 0.00

def **str**(self):

finalStr =self.CategoryName.center(30,’*’)+’\n’

for item in self.ledger:

description = item[‘description’]

if len(description)>23:

description = description[:23]

```
correctAm = str(format(item['amount'],'.2f'))
finalStr+=description+(' '*(30-(len(description)+len(correctAm))))+correctAm+'\n'
finalStr+=f'Total: {self.get_balance()}'
return finalStr
```

def create_spend_chart(categories):

categoryList =

for category in categories:

spent = round((category.ledger[0][‘amount’]-category.get_balance()))

percent = round(((spent*100)/category.ledger[0][‘amount’]))

categoryList.append([f’{category.CategoryName}’,percent])

print(category)

print(’\n\n\n’)

chart =‘Percentage spent by category\n’

for i in range(100,-10,-10):

chart +=(’ ‘*(3-len(str(i))))+f’{i}|’

for category in categoryList:

chart += ’ o ’ if category[1]>=i else ’ ’

chart +=’ \n’

chart +=’ ‘+’—’*len(categoryList)+’-’

i = 0

while True:

stateContinue = False

chart+=’\n ’

for category in categoryList:

if i<len(category[0]):

chart+=f’ {category[0][i]} ’

stateContinue = True

else:

chart+=f’ ’

if not stateContinue:

break

i+=1

print((chart))

return chart

**Your browser information:**

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

**Challenge:** Budget App

**Link to the challenge:**