Closed TomMonks closed 2 years ago
Exercise 4:
init method breaks PEP8 for line length.
suggested fix:
class Hospital: ''' Encapsulates a hosptial made up of wards... ''' def __init__(self, n_patients, age_ranges): self.wards = [new_ward(i, n_patients[i], age_ranges[i]) for i in range(len(n_patients))] def add_patient(self, ward_id, patient): self.wards[ward_id].add_patient(patient) def add_ward(self, n_patients=0, age_range=(60, 95)): to_add = new_ward(len(self.wards), n_patients, age_range) self.wards.append(to_add) @property def n_patients(self): return sum([ward.n_patients for ward in self.wards]) @property def n_wards(self): return len(self.wards)
fixed in Dev
Now live at pythonhealthdatascience.com
Exercise 4:
init method breaks PEP8 for line length.
suggested fix: