May-21-2020, 02:32 PM
im currntly lerning about classs and child class and parint
class Car: """a simple attempt to represent a car.""" def __init__(self,make,model,year): self.make = make self.model = model self.year = year self.odometer_reading = 0 def get_descriptive_name(self): long_name = f"{self.year} {self.make} {self.model}" return long_name.title() def read_odometer(self): print(f"this car has {self.odometer_reading} miles on it") def update_odometer(self,mileage): if mileage >= self.odometer_reading: self.odometer_reading = mileage else: print("you can't roll back an odometer !") def increment_odometer(self,miles): self.odometer_reading += miles class ElectricCar(Car): """represent aspects of a car ,specific to electric vehicles""" def __init__(self, make, model, year): """Initialize attributes of the parent class.""" super().__init__(make, model, year) my_tesla = ElectricCar('tesla','model s' , 2019) print(my_tesla.get_descriptive_name())
Error: File "C:\Users\alex8\Documents\python\python _work.py\chpter 9\electric_car.py", line 28
def __init__(self, make, model, year):
^
IndentationError: unindent does not match any outer indentation level
tenaks for the help