class Critter(object): def __init__(self, name, hunger = 0, boredom = 0): hunger = random.randint(0, 3) boredom = random.randint(0, 3) self.name = name self.hunger = hunger self.boredom = boredom def __pass_time(self): ... def __str__(self): ... @property def mood(self): ... def talk(self): ... @staticmethod def eat( food = 4): food = int(input("Сколько кусочков корма вы дадите им? От 1 до 5. ")) print("Мням-мням... Спасибо.") global hunger hunger -= food if hunger < 0: hunger = 0 self.__pass_time() @staticmethod def play(fun = 4): ... def main(): crit1 = Critter("Бобик") crit2 = Critter("Шарик") crit3 = Critter("Полкан") sp = [crit1, crit2, crit3] choice = None while choice != "0": print \ (""" Critter Caretaker
NameError: name ‘hunger’ is not defined