not finding the resone for the error - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Homework (https://python-forum.io/forum-9.html) +--- Thread: not finding the resone for the error (/thread-26995.html) |
not finding the resone for the error - yukhei - May-21-2020 im lerning classs and i have this error def increment_odometer(self,miles): self.odometer_reading += miles class Battery: """A simple attempt to model a battery for an electric car""" def __init__(self,battery_size=75): """intialize the battery's attributes.""" self.battery_size = battery_size def describe_battery(self): """print a statemennt describing the battery size""" print(f"this car has a {self.battery_size}-kWh battery.") class ElectricCar(Car): """represent aspects of a car ,specific to electric vehicles""" def __init__(self, make, model, year): """ Initialize attributes of the parent class. then initialize attributes specific to an electric car. """ super().__init__(make, model, year) self.battery = Battery() def fill_gas_tank(self): """Electric cars dont have gas tanks.""" print("this car dosen't need a gas tank!") my_tesla = ElectricCar('tesla','model s' , 2019) print(my_tesla.get_descriptive_name()) my_tesla.battery.describe_battery()
RE: not finding the resone for the error - deanhystad - May-21-2020 The message describes the problem precisely. The body of ElectricCar.__init__ is not indented correctly. Stop making that same mistake. RE: not finding the resone for the error - pyzyx3qwerty - May-22-2020 Also, please don't post multiple threads in the forum RE: not finding the resone for the error - deanhystad - May-22-2020 This is a second question that is only REALLY REALLY REALLY closely related to another question the poster has already asked. There are at least 10 more lines of code in this post. |