# Definition of the pet class class pet: #shared values go here maxcrowding = 10 # __init__ function initializes/creates new pets def __init__(self,n): # each pet has its own value: self.name = n # the name is passed in as an argument self.hungry = 50 self.happy = 50 # different pets metabolize food with different effciencies self.metabolismMeat = 0.9 self.metabolismVegitables = 0.3 def printPet(self): print(self.name," is ") print("Hunger: ",self.hungry) print("Happy: ",self.happy) def feedMeat(self): self.hungry -= (5 * self.metabolismMeat) print(self.name, " says 'Yum' ") def feedVegitables(self): self.hungry -= (5 * self.metabolismVegitables) print(self.name, " says 'Yummy' ") # Play makes a pet happier and hungrier def play(self): self.happy += 5 self.hungry += 3 p1 = pet("Bob") p1.printPet() p1.feedMeat() p1.printPet() p1.feedVegitables() p1.printPet()