Build a Budget App Project - Build a Budget App Project

Tell us what’s happening:

My code isn’t meeting these requirements “The transfer method should increase the balance of the category object passed as its argument.
The transfer method should create a specific ledger item in the category object passed as its argument.” and i have tried a bunch of different solutions, woukd really appreciate some insight.

Your code so far

def create_spend_chart(categories):
    return None

class Category:

    def __init__(self, name):
        self.name = name
        self.total = 0
        self.ledger = []

    def deposit(self, amount, description = ''):
        self.total += amount
        self.ledger.append({'amount': amount, 'description': description})

    def withdraw(self, amount, description = ''):
        if self.check_funds:
            self.total -= amount
            self.ledger.append({'amount': -amount, 'description': description})
            return True 

    def get_balance(self):
        return self.total

    def transfer(self, amount, instance):
        if self.check_funds:
            self.total -= amount
            self.ledger.append({'amount': -amount, 'description': 'Transfer to ' + instance.name})
            return True
        instance += amount
        self.ledger.append({'amount': +amount, 'description': 'Transfer from ' + self.name})
        return True

        
        

    def check_funds(self, amount):
        if amount <= self.total:
            return True
        else:
            return False

    
        
        

Your browser information:

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

Challenge Information:

Build a Budget App Project - Build a Budget App Project

The method should add a withdrawal with the amount and the description ‘Transfer to [Destination Budget Category]’. The method should then add a deposit

You have existing deposit and withdrawal methods, you should use those.

The method should then add a deposit to the other budget category with the amount and

You’ll need to access the deposit method of the other category. There’s the self category and the other category, they can be treated the same. Withdraw from self and deposit to other.

If there are not enough funds, nothing should be added to either ledgers. This method should return True if the transfer took place, and False otherwise.

Your method returns True and adds funds to the ledger if self.check_funds is false.