class Animal(object): """Makes cute animals.""" is_alive = True health = "good" 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("Jim",20) sloth = Animal("Jen",22) ocelot = Animal("Jill",18) print hippo.health print sloth.health print ocelot.health print hippo.description()
Actually this code works very well. However, with hippo.health(), the editor shows the following error:
TypeError: 'str' object is not callable.
What is a difference between