Python Forum
Getting error message for indentation
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getting error message for indentation
#1
HI

i am getting an error for incorrect indentation but can not find the error.
##30/04/19
##
##increment attributes through method

class Ereader():
	"""A class to represent an ereader"""

	def __init__ (self, make, model, backlight, battery, screentype):
		"""initialise the atributes to represent an ererader"""
		self.make=make
		self.modle=model
		self.backlight=backlight
		self.battery=battery
		self.screentype=screentype 
		self.libararycount=0

	def get_ereader_name(self):
		"""return a formatted description for our ereader"""
		long_name = self.make + " - " + self.model + " - " +self.backlight + " - " + self.battery + " - " + self.screentype
		return long_name.title()

	def read_libarary_count(self):
		print("You Have " + str(self.libararycount) + " books in your libarary")


	def update_laibary_count(self, ebook_count):
		"""set the libary count"""
		self.libararycount=ebook_count

	def increment_libary_count(self, purchased_ebooks):
		"""add new ebboks to libary count"""
		self.libararycount+=purchased_ebooks




		
class Screen():
	"""create a class to model the screen of a kindle fire"""

	def__init__ (self, screen_resoloution='1280*800')
		"""initialise the screens attributes"""

		self.screen_resoloution=screen_resoloution

	def describe_screen(self):
		"""print out some marketing information about the kindle fire"""
		##this tells the child class to call the features from the parent class
		print("fire HD 8 features a wide screen " + self.screen_resoloution+ " HD screen.")





class Kindlefire(Ereader):
	"""represents aspects of an ereader specific to a kindle fire
	then initialise atributes specific to a kindle fire"""

	def __init__ (self, make, modle, backlight, battery, screentype):
		"""initialize attributes for the kindle fire"""
		super().__init__(make, modle, backlight, battery, screentype)
		self.firescreen=Screen


my_kindle_fire = Kindlefire('amazon', 'kindlefire', 'backlight', '12 hour battrey life', 'colorscreen')
print(my_kindle_fire.get_ereader_name())


my_kindle_fire.firescreen.describe_screen()
Reply
#2
class Screen():
    """create a class to model the screen of a kindle fire"""
 
    def__init__ (self, screen_resoloution='1280*800')
#      ^ no space after def                          ^ no : at the end
Reply
#3
i am still getting indentation error on line 42.
##30/04/19
##
##increment atrabutes through method

class Ereader():
	"""A class to represent an ereader"""

	def __init__ (self, make, modle, backlight, battery, screentype):
		"""inatilase the atributes to represent an ererader"""
		self.make=make
		self.modle=modle
		self.backlight=backlight
		self.battery=battery
		self.screentype=screentype 
		self.libararycount=0

	def get_ereader_name(self):
		"""return a formatted description for our ereader"""
		long_name = self.make + " - " + self.modle + " - " +self.backlight + " - " + self.battery + " - " + self.screentype
		return long_name.title()

	def read_libarary_count(self):
		print("You Have " + str(self.libararycount) + " books in your libarary")


	def update_laibary_count(self, ebook_count):
		"""set the libary count"""
		self.libararycount=ebook_count

	def increment_libary_count(self, purchesed_ebooks):
		"""add new ebboks to libary count"""
		self.libararycount+=purchesed_ebooks




		
class Screen():
	"""create a class to model the screen of a kindle fire"""

	def__init__(self, screen_resoloution='1280*800')
		"""initialize the screens attributes"""

		self.screen_resoloution=screen_resoloution

	def describe_screen(self):
		"""print out some markjeting information about the kindle fire"""
		##this tells the child class to call the fetures from the parent class
		print("fire HD 8 fetures a wide screen " + self.screen_resoloution+ " HD screen.")





class Kindlefire(Ereader):
	"""represents aspects of an ereader spicific to a kindle fire
	then initilaise atributes spicific to a kindle fire"""

	def__init__(self, make, modle, backlight, battery, screentype):
		"""initlize atributes for the kindle fire"""
		super().__init__(make, modle, backlight, battery, screentype)
		self.firescreen=Screen


my_kindle_fire = Kindlefire('amazon', 'kindlefire', 'backlight', '12 hour battrey life', 'colorscreen')
print(my_kindle_fire.get_ereader_name())


my_kindle_fire.firescreen.describe_screen()
Output:
line 42 """initialize the screens attributes""" ^ IndentationError: unexpected indent
Reply
#4
You didn't fix the errors i pointed out.
Reply
#5
sorry. my mistake..Thank You
Reply
#6
No worries, at least you improved on how you reported the error by giving a full trace back Dance
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Error message about iid from RandomizedSearchCV Visiting 2 1,006 Aug-17-2023, 07:53 PM
Last Post: Visiting
  Another Error message. the_jl_zone 2 974 Mar-06-2023, 10:23 PM
Last Post: the_jl_zone
  Mysql error message: Lost connection to MySQL server during query tomtom 6 15,987 Feb-09-2022, 09:55 AM
Last Post: ibreeden
  understanding error message krlosbatist 1 1,903 Oct-24-2021, 08:34 PM
Last Post: Gribouillis
  Error message pybits 1 39,901 May-29-2021, 10:26 AM
Last Post: snippsat
  f-string error message not understood Skaperen 4 3,328 Mar-16-2021, 07:59 PM
Last Post: Skaperen
  Overwhelmed with error message using pandas drop() EmmaRaponi 1 2,357 Feb-18-2021, 07:31 PM
Last Post: buran
  Winning/Losing Message Error in Text based Game kdr87 2 2,984 Dec-14-2020, 12:25 AM
Last Post: bowlofred
  Don't understand error message Milfredo 2 2,047 Aug-24-2020, 05:00 PM
Last Post: Milfredo
  Indentation Error With If Else Statement JoeDainton123 3 1,810 Aug-02-2020, 08:29 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