# Issues on Chapter Introduction to class Exercice 18

#1

I have the error on the chapter "Introduction to class" on exercice "18 Heritage(inherent)": "Oups, merci de réessayer. Avez-vous créé une classe nommée Equilateral? (did you create the Equilateral class".

I tried to search on internet if there is an old topic on it but didn't find...

But my code has the Equilateral class... See below...

``````class Triangle():
def __init__(self, angle1, angle2, angle3):
self.angle1 = angle1
self.angle2 = angle2
self.angle3 = angle3
nombre_de_cotes = 3
def verifier_angles(self):
if (self.angle1+self.angle2+self.angle3 == 180):
return True
return False

class Equilateral(Triangle):
def __init__(self):
self.angle1 = angle
self.angle2 = angle
self.angle3 = angle
angle = 60

mon_triangle = Triangle(90, 30, 60)
print mon_triangle.nombre_de_cotes
print mon_triangle.verifier_angles()``````

Ps : it's my first question sorry if it's not so well fill

#2

can you paste the instructions of the exercise or the link to it please?

#3

For the instruction it's in French so if the link doesn't work tell me and i'll give you a bad english translation

THANKS !

#4

Your "if" it's missing an "else" statement.

The global variables of a class needs to be always declared before you use them, also you need to add "self" to the "angle" variable because you are not passing it as a parameter of the init function.

If you make those corrections it should work, good luck .

#5

YEAHHH it works !!! Oups my mistake great I changed self.angle ! Thanks for the explanation !!
By the way for the first error I'm not sure I have to add a ELSE 'cause if the test is FALSE it goes automatically through the second return and return FALSE... I use this in C#... doesnt work on python ?

Thanks again Gargol12 !

#6

Glad to hear that it works

It works it's just a convention to make your code more readable, here it's a complete discussion about it.

#7

Good Idea make the code readable !! I always work alone on project bad habit...
Thanks and have a nice day !!!

#8

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