A methodical approach--error inexpected indent


#1

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>

Introduction to Classes : 8. A methodical Approach

<In what way does your code behave incorrectly? Include ALL error messages.>
The following error shows on console

File “python”, line 8
def description(self):
^
IndentationError: unexpected indent

<What do you expect to happen instead?>
Behave normally and print name and age of animal



class Animal(object):
  """Makes cute animals."""
  is_alive = True
  def __init__(self, name, age):
    self.name = name
    self.age = age
  # Add your method here!
	def description(self):
    print self.name 
   	print self.age

hippo = Animal("hi po", 3)
print hippo.description()


https://www.codecademy.com/courses/learn-python/lessons/introduction-to-classes/exercises/a-methodical-approach?action=lesson_resume


#2

One look at the code and above indicated error jumps right out.

When this error occurs, it is helpful to go through the code from top to bottom and adjust the indentation to match its appropriate block level.


#3

Oh thanks…couldn’t find any error but re-wrote the code once again
I could have done that earlier
Thanks once again :slight_smile:


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.