Question: Write a python class named Pet, which should have the following data attributes: . name (for the name of a pet) .-type (for the type
Write a python class named Pet, which should have the following data attributes: . name (for the name of a pet) .-type (for the type of animal that a pet is. Example values areDog"Cat. and Bird') The Pet class should have an init .method that initialize these data attributes. The Pet class should also have setter and getter methods for both of the data attributes. Additionally, the Pet class should have a make, sound method which prints Grrr For your reference, attached the Automobile class which has appeared in exercises before: class Automobile def init (self, make, model, mileage): self.--make-make self.model model self._mileage mileage def set make(self, make): self. _make make def set model(self, model): self..model model def set mileagetself, mileage: self.mileage mileage def get make(self): return self. make def get model(self): return self. model def get mileagelself): return self. . mileage
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
