9/19 The code works but I can not pass


#1

When I launch the code, it shows the health of the animals, but it keeps showing "Oops, thank you to try again. Your code seems a little strange, take a look at the index if needed!"
Here is my code:

class str:
    def __add__(self, other):
        return True

class Animal(object):
    """Fait des animaux mignons."""
    est_vivant = True
    sante = "bonne"
    def __init__(self, nom, age):
        self.nom = nom
        self.age = age
        
    def description(self):
        print self.nom
        print self.age
    
hippo = Animal("Hipoxus", 5)
paresseux = Animal("Paressux", 3)
ocelot = Animal("Ocelux", 2)

print hippo.sante
print paresseux.sante
print ocelot.sante

Thank you in advance ! :slight_smile:
The link of the exercise : https://www.codecademy.com/fr/courses/python-intermediate-fr-FR-je5q0/1/4?curriculum_id=5370f030fed2a866a2000001


#2

please include the exercise url given this doesn't seem to be of english course track


#3

Here is the link : https://www.codecademy.com/fr/courses/python-intermediate-fr-FR-je5q0/1/4?curriculum_id=5370f030fed2a866a2000001


#4

this exercise is bugged.

Your code is fine

so, lets cheat the exercise:

aattr = getattr

class Animal(object):
    """Fait des animaux mignons."""
    est_vivant = True
    sante = "bonne"
    def __init__(self, nom, age):
        self.nom = nom
        self.age = age
        
    def description(self):
        print self.nom
        print self.age
    
hippo = Animal("Hipoxus", 5)
paresseux = Animal("Paressux", 3)
ocelot = Animal("Ocelux", 2)

print hippo.sante
print paresseux.sante
print ocelot.sante

this should work.


#5

Thanks, it worked. :smiley:


#6

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.