15/18


#1



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


What is wrong with my code please ?
The def doesn't appear in velvet. strange.


class Triangle(objet):
    def__init__(self, angle1, angle2, angle3):
        self.angle1 = angle1
        self.angle2 = angle2
        self.angle3 = angle3

Oups, merci de réessayer. Avez-vous créé une classe nommée Triangle? 

In the console 

 File "python", line 2
    def__init__(self, angle1, angle2, angle3):
                                             ^
SyntaxError: invalid syntax


#2

@snakefinger33gmail.c ,

There should be a space in here, between def and __init__ ...

def__init__(self, angle1, angle2, angle3):

Also, define Triangle to inherit from object instead of from objet.


#3

Hi again.

Triangle(objet):
def __ init__(self, angle1, angle2, angle3):
self.angle1 = angle1
self.angle2 = angle2
self.angle3 = angle3
In the french lesson it is objet. I try with object but it doesn't work.
Always the same message :

Oups, merci de réessayer. Avez-vous créé une classe nommée Triangle?

File "python", line 1
Triangle(objet):
^
SyntaxError: invalid syntax


#4

class Triangle(object):
def init(self, angle1, angle2, angle3):
self.angle1 = angle1
self.angle2 = angle2
self.angle3 = angle3

I have added class before triangle(i've forgotten this) and change objet to object and now it works.
Thanks


#5

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