Cannot understand why I am getting an error?

Viewed 39

I cannot understand why I am getting TypeError() :housingLoan() takes no arguments when I am creating an instance . I tried researching on the web regarding this error , no success. I am currently learning OOPs in python. So this sample program I created but got stuck , pls help!

from main import Loan


class housingLoan(Loan):

    def __init__(self, customer_name: str, principal_amount: float, time_period: int, rate_of_interest: float):
        super().__init__(
            customer_name, principal_amount, time_period, rate_of_interest
        )



hs1 = housingLoan("Jay", 100000, 3, 0.8)

class Loan:
    all = list()

    def __int__(self, customer_name: str, principal_amount: float, time_period: int, rate_of_interest: float):
        self.__customer_name = customer_name
        self.principal_amount = principal_amount
        self.time_period = time_period
        self.rate_of_interest = rate_of_interest
        assert principal_amount >= 100000, f"Principal Amount {principal_amount} should always be greater than 100000."
        assert time_period >= 1, f"Time period {time_period} should always be greater than or equal to 1 year."

        Loan.all.append(self)

    @property
    def name(self):
        return self.__customer_name


    def calculate_rate_of_interest(self):
        interest = (self.principal_amount * self.time_period * self.rate_of_interest) / 100
        return interest

0 Answers
Related