My code is
dogs = []
cats = []
class dog:
def __init__(self,name):
self.name = name
dogs.append(self)
class cat:
def __init__(self,name):
self.name = name
cats.append(self)
dog1 = dog("steve")
dog2 = dog("dave")
cat1 = cat("simon")
cat2 = cat("elizabeth")
print(dogs[0], cats[0])
If i run this code it gives me
[<__main__.dog object at 0x7fc51434c6a0>, <__main__.cat object at 0x7fc51434c700>]
what is this called? and I want to try to get the name the animal use that code if i can
Later I want to have a player that can buy pets, and if player inputs "steve" it will add dog("steve") to players inventory using the codes up there.
My problem is that I do not know what it is called