Quotes help make search much faster. Example: "Practice Makes Perfect"

Sunday, December 2, 2012

Codecademy: A Methodical Approach


#sample solution


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 "My name is %s." % (self.name)
print "I'm %s years old." % (self.age)

hippo = Animal("Hippy",70)
hippo.description()

1 comment:

  1. not working: Oops, try again. Animal('Baloo', 24).description() did not print 'Baloo' and '24' on separate lines as expected, instead it printed: 'My name is Baloo.' and "I'm 24 years old."

    ReplyDelete


This is an example of scrolling text using Javascript.

Popular Posts