8. It prints some odd message, but it tells me I've passed?


#1

Hi, I filled in the info for making a hippo so that when I print hippo.description it’s supposed to print the (name, age), but when I run it, the system gives me a check mark, but it prints this instead:

<bound method Animal.description of <Animal object at 0x7fcdc03c78d0>>

Can someone help explain what’s going on? Thanks


#2

to execute a method you need parentheses, just like with functions:

def example():
    print "hello world"

print example # information about function
print example() # execute function

i am too lazy to do a full class + method example, but the principal is the same


#4

Thanks stetim, I got it to work after I put in () after the thing!
It printed correctly, but after the result, printed None
I guess this isn’t that important right now…


#5

None is the default returned value, if you don’t want it printed you could remove the print statement from before the method call


#6

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