Initializing conditions variable
When adding the conditions variable, why wasn't it added to the def _init_(self, name, age) query? Is it not necessary to add all variables in the arguments of the initialization?
Hey Sara,
Thank you for reaching out!
It is not necessary to add as arguments all variables defined in the __init__
method. Inside this method, you are defining the variables intrinsic to each instance of the class.
Upon creating an instance of the Patient()
class and upon providing the name and the age of the patient as arguments, the __init__
method will do the following:
1. create a variable self.name
storing the name of the patient;
2. creates a variable self.age
storing the age of the patient;
3. prepare an empty list self.conditions
which can be populated through the add_info()
method.
Hope this helps!
Kind regards,
365 Hristina