from random import randint # get random

# general pet class
class pet:

    # instance variables
    name = ""
    color = ""
    weight = 0

    # Our pet constructor
    def __init__ (self, petName, petColor, petWeight):
        self.name = petName
        self.color = petColor
        self.weight = petWeight

    # to string method
    def __str__ (self):
        return "Your pet's name is " + self.name + ". It's color is " + self.color + " and it weighs " + self.weight + "."
    
    # pet our pet! Named it better to not get it confused with the class
    def showAffection(self):
        print("You pet " + self.name + "!!")

# Since cats are pets, let's inherit our pet constructor!
class cat(pet):

    # Cat scratches can hurt, so let's use damage as an instance variable special to cats (but not all pets)
    clawDmg = 0

    # Construct your cat object (note that we NEED super because cats NEED to have all the other attributes of pets as well like name, color, and weight)
    def __init__ (self, petName, petColor, petWeight):
        super().__init__(petName, petColor, petWeight)
        self.clawDmg = randint(0, 10) # randomize the damage
    
    # ouch!
    def scratch(self):
        print(self.name + " scratched you! You took", self.clawDmg, "damage.")


def main():
    # lets make a list of the pets
    pets = []

    # Our first pet
    bruno = pet("Bruno", "Brown", 30)
    pets.append(bruno)
    pets[0].showAffection()

    # Our cat! (Still a pet)
    nilly = cat("Nilly", "Gray", 5)
    pets.append(nilly)
    pets[1].showAffection()
    pets[1].scratch()
    
main()
    

    