Build a Budget App - Build a Budget App

Tell us what’s happening:

Hi, I have followed the user stories from 1 to 4 with the below code, but when I run the test, none passes. And I see no comment in the console. Maybe I need to use F12, but I have a MacBook Air, and I am not sure how to use F12 (when I call it, nothing happens). Can you please help?

Your code so far

class Category:
    
    def __init(self, name):
        self.name = name
        self.ledger = []
        self.balance = 0.0

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

    def withdraw(self, amount, description = ''):
        if self.check_funds(amount):
            self.deposit(-amount, description)
            return True
        else:
            return False

    def get_balance(self):
        return self.balance

    def transfer(self, amount, another_category):
        if self.check_funds(amount):
            self.balance -= amount
            self.ledger.append({'amount': -amount, 'description': f'Transfer to {another_category.name}'})
            another_category.deposit(amount, f'Transfer from {self.name}')
            return True
        else:
            return False

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

    def __str__(self):
        output = self.name.center(30,'*') + '\n'
        for item in self.ledger:
            amount = item['amount']
            description = item['description']
            output += f'{description[0:23]:23}{amount:7.2f}'
            output += '\n'
        
        output += 'Total: '
        output += format(self.balance, '.2f')

        return output

def create_spend_chart(categories):  
    pass

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.3.1 Safari/605.1.15

Challenge Information:

Build a Budget App - Build a Budget App

Try testing your class. If you write a function and don’t call it, nothing is really happening.

You can see some tests in the instructions. “Here is an example usage:”

you can find out how to open the browser console for your OS and browser if you research it