Question: Why Is it possible to referencing something that is not defined yet?
Hi everyone, I’ve been searching and thinking for hours why Is this possible, but I don’t understand it, I would be glad to read your explanations.
def withdraw(self, amount, description=""):
"""
A withdraw method that is similar to the deposit method, but the amount passed in should be stored in the ledger as a negative number. If there are not enough funds, nothing should be added to the ledger. This method should return True if the withdrawal took place, and False otherwise
"""
if(self.check_funds(amount)):
self.ledger.append({"amount": -amount, "description": description})
return True
return False
In this block of code check_funds is not defined yet and It’s possible to referencing it. Why?
Thank you.