I don't see my mistake.
I would appreciate an help.

class Voiture(object):
    condition = "nouveau"
    def __init__(self, modele, couleur, mpg):
        self.modele = modele
        self.couleur = couleur
        self.mpg   = mpg
    def afficher_voiture(self):
        return "ceci est + self.modele +  + self.couleur +  avec  + str(self.mpg) + MPG."

class VoitureElectrique(Voiture):
    def __init__(self, type_batterie):
        self.type_batterie = type_batterie

ma_voiture = Voiture("DeLorean", "argent", 88)
print ma_voiture.afficher_voiture()

class VoitureElectrique(Voiture):
    def __init__(self, modele, couleur, mpg, type_batterie):
        self.modele = modele
        self.couleur = couleur
        self.mpg   = mpg
        self.type_batterie = type_batterie

    def conduire_voiture(self):
        self.condition = "comme neuve"
        return self.condition
ma_voiture = VoitureElectrique("Lotus", "noir", 77, "pile thermique")
print ma_voiture.condition 
print ma_voiture.condition

Oups, merci de réessayer. Assurez vous que votre classe Voiture a une methode conduire_voiture().

In the console everything seems to be correct :

ceci est + self.modele + + self.couleur + avec + str(self.mpg) + MPG.
comme neuve


Please re-edit your post and display the code with proper indentation.....

You are asked to place the conduire_voiture() Method in
votre classe Voiture

Please re-edit your Post

  • leave one blank-line above of your code
  • select your code in the Post
  • then =click= on the </>-symbol-of-this-editor

Your code will then be in a pre-code state
and you will be able to make/present the proper indentations.

With Courtesy to stetim94

or even better use
= https://discuss.codecademy.com/t/how-do-i-format-code-in-my-posts/28351


Hi again Leoanard.
I have resolved this problem.
I am now trying to do the output function in part 21.


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