Transfer Method in the Budget App

Tell us what’s happening:
As my code is currently written, the transactions for both of my categories are going on to the same ledger. Is the transfer method supposed to generate a new instance of the Category class so that there will be two separate ledgers? I get the feeling that it is, but I am at a loss for how to figure this out.

Your code so far
def transfer(self, amount, other_category):
if self.check_funds(amount):
self.withdraw(amount, description=f"Transfer to {other_category}")
self.deposit(amount, description=f"Transfer from {self.category}")
return True
else:
return False
pass

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:81.0) Gecko/20100101 Firefox/81.0.

Challenge: Budget App

Link to the challenge:

Apologies, I did not notice that the indentation went away when I pasted my code.

Next time post a link to your entire code, just to be safe.

That’s because you call self.deposit() instead of other_category.deposit()

Thanks. I’ve almost figured it out, but I’m still encountering the same core problem.

Is the transfer method supposed to generate a new instance, or is it simply supposed to refer to an instance of the class that has already been created?

Here is a link to my code.

The transfer is just referring to an already created instance :wink:
You can also just read the actual testcases in the project by openeing the test-module.py (I think that’s how it’s called). There are all tests written out with the expected results as well.
For example, there you would see that the instances of the class are created before calling transfer().

OK, that clears things up for me. Thanks!

@dalen.carr
It seems that you are transferring the funds from
one ledger to the same ledger.As per the instruction it is to another budget category .(means another ledger)Mr. jagaya already cleared it.Read his instructions carefully and change your code accordingly.
@dalen.carr , best wishes