Hey there,
I have a feeling this is something really silly but for the life of me, I can’t figure out the issue.
I’m making these calls to run some quick tests on my code.
It’s telling me withdraw() takes 0 arguments when I’ve defined the arguments it should take.
I’m stomped
food = budget.Category("Food")
food.deposit(1000, "initial deposit")
food.withdraw(10.15, "groceries")
food.withdraw(15.89, "restaurant and more food for dessert")
budget.py file:
class Category:
def __init__(self, category):
self.name = category
self.ledger = []
self.total_amount = 0
self.withdraw_amount = 0
def check_funds(self, amount):
print('in check_funds')
if amount > self.total_amount:
return True
return False
def deposit(self, amount, description=None):
if description is None:
deposit_item = {"amount": amount, "description": ''}
self.ledger.append(deposit_item)
self.total_amount += amount
else:
deposit_item = {"amount": amount, "description": description}
self.ledger.append(deposit_item)
self.total_amount += amount
def withdraw(self, amount, description=None):
check = self.check_funds(amount)
print(check)
Error I’m getting:
check_funds() takes 0 positional arguments but 2 were given