When a class has its own functions, those functions are called methods. You’ve already seen one such method: __init__(). But you can also define your own methods!



Add a method, description, to your Animal class. Using two separate print statements, it should print out the name and age of the animal it’s called on. Then, create an instance of Animal, hippo (with whatever name and age you like), and call its description method.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?