Last answered:

14 Nov 2022

Posted on:

14 Nov 2022

0

TypeError: Patient() takes no arguments

I tried running this and got an error message.

class Patient(object):
    def _init_(self,name,age):
        self.name = name
        self.age = age
steve = Patient('Steven Hughes', 48)

the error message is below:
steve = Patient('Steven Hughes', 48)

TypeError: Patient() takes no arguments

1 answers ( 0 marked as helpful)
Instructor
Posted on:

14 Nov 2022

0

Hey Pius,

Thank you for reaching out!

Please, note that the __init__ function is defined with two underscores on both sides instead of one. Once this is corrected, you shouldn't experience any problems.

Kind regards,
365 Hristina

Submit an answer