health-data-science-OR / coding-for-ml

Learning materials for Coding for Machine Learning and Data Science
https://www.pythonhealthdatascience.com
MIT License
15 stars 4 forks source link

Issue on page /content/01_algorithms/06_solutions/02_basic_oop.html #20

Closed TomMonks closed 2 years ago

TomMonks commented 2 years ago

Exercise 2:

The example solution init() method missed self.ward_id = ward_id. The code should be:

class Ward:
    def __init__(self, ward_id):
        self.ward_id = ward_id # this is missing
        self.patients = []

    def add_patient(self, patient): 
        self.patients.append(patient)

    @property
    def n_patients(self):
        '''
        Number of the patients...
        '''
        return len(self.patients)
TomMonks commented 2 years ago

fixed in Dev

TomMonks commented 2 years ago

Now live at pythonhealthdatascience.com