I'm trying this problem. I don't see the error and i don't kwon why. This is the code that I made:
class Aquarium:
def __init__(self):
self.animales = [] # Atributo de instancia, lista vacĂa
print('An Aquarium has opened!')
def enters(self,animal):
self.animal= animal
for i in range(len(self.animales)):
if animales[i] == animal:
self.animales.append(animal)
print("We already have" + self.animal)
else:
print(self.animal + 'is a new member of our Aquarium')
I need to create a code using class Aquarium
and get this:
my_aquarium = Aquarium()
An Aquarium has opened!
my_aquarium.enters('Turtle')
Turtle is a new member of our Aquarium!
my_aquarium.enters('Turtle')
We already have Turtle.