10/11


#1



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


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 
ma_voiture.conduire_voiture()
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.
nouveau
comme neuve
None


#2

@snakefinger33gmail.c
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
https://discuss.codecademy.com/t/im-having-a-problem-on-lesson-11-23/2307/3?u=leonhard.wettengmx.n

or even better use
= https://discuss.codecademy.com/t/how-do-i-format-code-in-my-posts/28351
[extra's]
https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet


#3

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


#4

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