Jan-20-2019, 11:29 AM
Hi Guys,
I am studying a mark scheme answer from a previous exam question and when following the mark scheme on Python , I am presented with an error: TypeError: __init__() missing 3 required positional arguments: 'MemberName', 'MemberID', and 'SubscriptionPaid'
The focus is on practicing Methods:
methods
• SetMemberName
• SetMemberID
• SetSubscriptionPaid
I have played around with the code and used various methods to pass the arguments, unfortunately, still presented with this error.
Any help appreciated.
__init__ function of Member class has 3 arguments.
When I am calling super().__init__() from JuniorMember class I am passing 3 arguments now - but it says NameError: name 'MemberName' is not defined
I am studying a mark scheme answer from a previous exam question and when following the mark scheme on Python , I am presented with an error: TypeError: __init__() missing 3 required positional arguments: 'MemberName', 'MemberID', and 'SubscriptionPaid'
The focus is on practicing Methods:
methods
• SetMemberName
• SetMemberID
• SetSubscriptionPaid
I have played around with the code and used various methods to pass the arguments, unfortunately, still presented with this error.
Any help appreciated.
class Member() : def __init__(self, MemberName, MemberID, SubscriptionPaid): self.__MemberName = "" self.__MemberID = "" self.__SubscriptionPaid = False def SetMemberName(self, Name): self.MemberName = Name def SetMemberID(self, ID): self.MemberID = ID def SetSubscriptionPaid(self, Paid): self.SubscriptioPaid = Paid class JuniorMember (Member): def __init__(self): super().__init__() self.DateOfBirth="" def SetDateOfBirth(self, Date): self.DateOfBirth = Date NewMember=JuniorMember() NewMember.SetMemberName("Ali") NewMember.SetMemberID("12345") NewMember.SetSubscriptionPaid(True) NewMember.SetDateOfBirth("12/11/2001")
__init__ function of Member class has 3 arguments.
When I am calling super().__init__() from JuniorMember class I am passing 3 arguments now - but it says NameError: name 'MemberName' is not defined
super().__init__(MemberName, MemberID, SubscriptionPaid)