Help: Output showing <budget.Category object at 0x7eff2a0c4d00> instead of the actual name of the category. (budget app project)

Title

Replit link:https://replit.com/@f488/boilerplate-budget-app#budget.py

class Category:
def init(self, cat):
self.cat = cat
self.ledger =
self.balance = 0

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

def withdraw(self, amount=0.0, description=''):
    amount = -amount
    # dumb test case doesn't want return self.ledge for input without description
    if self.balance + amount >= 0 and description == '':
        self.balance += amount
        d = {'amount': amount, 'description': description}
        self.ledger.append(d)
        return True
    if self.balance + amount >= 0:
        self.balance += amount
        d = {'amount': amount, 'description': description}
        self.ledger.append(d)
        return self.ledger
        return True
    else:
        return False

def get_balance(self):
    return self.balance

def transfer(self, transfer_amount, transfer_cat):
    if self.balance - transfer_amount < 0:
        return False
    else:
        **# here lies the problem** 
        self.withdraw(transfer_amount, f'Transfer to {transfer_cat}')
        transfer_cat.deposit(transfer_amount, f'Fransfer from {self.cat}')

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

Challenge: Budget App

Link to the challenge:

Bad naming, I’d say?
transfer_cat is a category object. It’s name is in the .cat attribute, as you used in the next line with self.cat.

Thanks, it worked, I thought that because transfer_cat was only in the transfer method I didn’t have to put the .cat at the end.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.