Python Forum
not finding the resone for the error
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
not finding the resone for the error
#1
im lerning classs and i have this error Wall

	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()
Error:
File "C:\Users\alex8\Documents\python\python _work.py\chpter 9\electric_car.py", line 44 super().__init__(make, model, year) ^ IndentationError: unindent does not match any outer indentation level
Reply
#2
The message describes the problem precisely. The body of ElectricCar.__init__ is not indented correctly. Stop making that same mistake.
Reply
#3
Also, please don't post multiple threads in the forum
pyzyx3qwerty
"The greatest glory in living lies not in never falling, but in rising every time we fall." - Nelson Mandela
Need help on the forum? Visit help @ python forum
For learning more and more about python, visit Python docs
Reply
#4
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  not find the resone it not prints yukhei 3 1,823 May-22-2020, 03:36 PM
Last Post: deanhystad
  not finding the resone for the error yukhei 3 2,139 May-21-2020, 04:43 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020