The code seems to be intact, I don’t know what’s wrong. Here is the error:
Traceback (most recent call last): File "python", line 23, in <module> NameError: name 'money' is not defined Here is the code:
class School: def __init__(self,money,pupils,averageCost,equipment): self.money = money self.pupils = pupils self.averageCost = averageCost self.equipment = equipment def count(self,money,pupils,averageCost,equipment): x = 0 while x > -1: x += 1 self.money += averageCost * pupils self.equipment -= 1 return self.money return self.pupils return self.averageCost return self.equipment school_1 = School(10000,80,250,15000) school_1.count(money,pupils,averageCost,equipment)
money,pupils,averageCost,equipmentnot declared and not initialized before the call:school_1.count(money,pupils,averageCost,equipment)- MaxUschool_1.count(money,pupils,averageCost,equipment)you refer to external (not related to class variables) variables - MaxUcountaccept these variables at all? He can get them throughself, and they are absolutely not needed in the function arguments - andreymal