Sorry, I'm struggling at this for quite some time. I'm trying to use function totalPayments which uses the monthlyPayment class function with parameters pass through in the initialisation phase. I'm getting an error missing 2 required positional arguments
class Loan(object):
def __init__(self, asset, face, rate , term):
self._asset = asset
self._face = face
self._rate = rate
self._term = term
@classmethod
def monthlyPayment(cls,face,rate,term,period=None):
return ((rate*face*((1+rate)**term)))/(((1+rate)**term)-1)
def totalPayments(self):
return (self.monthlyPayment(self) * self._term)
l = Loan(None,1000,0.025,10)
print(l.totalPayments()) # gets an error missing 2 required positional arguments
edit: Thank you very much for the hekp and I should be amending my def monthlyPayment function to take in the arguments