Untitled

 avatar
unknown
python
2 years ago
829 B
7
Indexable
   #Calculating how many male clients are over 40 and hence at higher risk of heart failure.
    def male_over_40(self):
        target_dem_total = 0
        for i, client in enumerate(self.ages):
            if client >= 40 and self.sexes[i] == 'male':
                target_dem_total += 1
                
                

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[73], line 1
----> 1 patient_info.male_over_40()

Cell In[69], line 42, in ClientData.male_over_40(self)
     40 target_dem_total = 0
     41 for i, client in enumerate(self.ages):
---> 42     if client >= 40 and self.sexes[i] == 'male':
     43         target_dem_total += 1

TypeError: '>=' not supported between instances of 'str' and 'int'
Editor is loading...