Learn
Introduction to Classes
A Methodical Approach

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!

Instructions

1.

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.

Folder Icon

Take this course for free

Already have an account?