17/18 for an HELP


#1



https://www.codecademy.com/fr/courses/python-intermediate-fr-FR-je5q0/3/3?curriculum_id=5370f030fed2a866a2000001#


I really need and HELP Please !


class Triangle(object):
    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
    else:
        return False

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

3
Traceback (most recent call last):
  File "python", line 16, in <module>
AttributeError: 'Triangle' object has no attribute 'verifier_angle'


#2

@snakefinger33gmail.c,
As you did NOT us an indentation with your
def verifier_angles(self):
the definition is NOT seen by the PYTHON interpreter
as being part of the class Triangle definition.
thus you will have to use

class Triangle(object):
    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
        else:
            return False

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

It might be that you have to do a refresh Browser
++++ reset of session *****************
under certain circumstances you can shoot your Browser in an
inconsistent state.

Therefor it is of an advantage to know that you have 2 reset facilities:

One is the use of the F5-key which does a refresh Browser

and

Two, select&copy your code
Then use the Reset Code button of the course-window,
then paste your code back in.

Addendum
General Notes:
Always refresh the browser after making corrections:
CTRL f5 ( if on Windows or Linux)
CMD r ( if on a MAC).
CTRL 0 to reset browser zoom


#3

Hi Leonard.
Thank you for your help.
You are an Expert.

Now i start to learn Javascript.


#4

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