class pet: # shared variables: food? # "constructor" def __init__(self): self.name = input("Name? ") self.color = input("Color? ") self.hungry = 50 self.happy = 50 self.healthy = 50 self.sleepy = 50 def print(self): print(self.name + " is " + self.color) print("Hungry: " + str(self.hungry)) print("Happy: " + str(self.happy)) def feed(self): print("Yummy") self.hungry = self.hungry - 5 self.happy = self.happy + 2 def play(self): choice = input("1) catch 2) roll over") if(choice == "1"): print("Caught the ball") self.happy = self.happy+5 if(choice == "2"): print("Good rolling over") self.happy = self.happy+3 self.hungry = self.hungry + 5 def start(): for i in range(len(flock)): flock[i].print() while(True): petnum = input("Which pet? 1 to " + str(len(flock)) ) choice = input("1) Feed 2) Play 3) Add pet") if(choice == "1"): flock[int(petnum)-1].feed() if(int(choice) == 2): flock[int(petnum)-1].play() if(int(choice) == 3): flock.append(pet()) for i in range(len(flock)): flock[i].print() flock = [] flock.append(pet()) flock.append(pet()) start()