Adding Coat Color (Exercise)
Well, let’s get started with the first actual exercise where you do something new. In this exercise, your task is to modify the
Dog class to include a third instance attribute called
.coat_color, which stores the color of the dog’s coat as a string.
00:14 You should store the new class in the file and test it out by adding the following code at the bottom of that file. Again, we’re going to work with Philo, whose name I can’t pronounce, but that’s okay.
It seems like it’s just about adding a third instance attribute and then printing it out. Maybe we’re going to also do something with the
.__str__() method to include the coat color into the
print() output—a little stretch goal that you could do if you want to, but it looks like you don’t even have to.
Become a Member to join the conversation.