Hello and nice meeting you all. This is my first post !
I stormed through the codeacademy tutorial of python and i really enjoy and understand it ,then Classes happened.
I could use a little help with this:
Here is the code in text:
class Car(object): condition = "new" def __init__(self, model, color, mpg): self.model = model self.color = color self.mpg = mpg def display_car(self): print "This is a "+self.color+" "+self.model+" with "+str(self.mpg)+" MPG." def drive_car(self): self.condition="used" class ElectricCar(Car): def __init__(self,battery_type): Car.__init__(self, model, color, mpg) self.battery_type=battery_type my_car=ElectricCar('Tesla','blue',1,'molten salt')
Please explain to me what's wrong with it and why doesn't it work.
Thanks in advance!