Last answered:

19 Apr 2022

Posted on:

08 Jan 2022

0

Have codes exactly like what the teacher shows but can't make it work

I wrote the codes exactly like what was shown to us in the video. However there is an error in the console after running the code "steve = Patient...". See below:

steve = Patient('Steven Hughes', 48)

TypeError: Patient() takes no arguments

Thanks.

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

10 Jan 2022

0

Hey Christine,

Thank you for your question!

If you have copied the code exactly as it is in the video, then you should have no problem running it. Make sure that you have defined your __init__ function properly, namely:

def __init__(self, name, age):
    ...

Kind regards,
365 Hristina

Posted on:

19 Apr 2022

1

you need to use two underscore instead of one with the init function so it's going to be
__init__ instead of _init_

Submit an answer