Challenge 7
This challenge is intended to be taken after the classes section.
Problem 1: The Dog Class
- Create a class called
Dog. - The
__init__method should takenameandbreedas arguments. - Create an instance method called
barkthat prints "Woof!". - Create an instance of your
Dogclass and call thebarkmethod.
Problem 2: The Car Class
- Create a class called
Car. - The
__init__method should takemake,model, andyear. - Use the
@propertydecorator to create adescriptionproperty that returns a string like "2023 Honda Civic". - Create an instance of the
Carand print itsdescription.
Problem 3: Inheritance
- Create a
Personclass withnameandageattributes. - Create a
Studentclass that inherits fromPerson. - The
Studentclass should have an additionalstudent_idattribute. - Create an instance of
Studentand print out their name, age, and student ID.