Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Cars():
- def __init__(self, car_name):
- self.name = car_name
- self.description = None
- self.engine_type = {}
- def set_name(self, car_name):
- self.name = car_name
- def set_description(self, car_description):
- self.description = car_description
- def get_description(self):
- return(self.description)
- def describe(self):
- print(self.description)
- def get_name(self):
- return (self.name)
- def engine_types(self, engine_in_car):
- self.engine_type = engine_in_car
- print(self.name + " has a " + repr(self.engine_type))
- from cars import Cars
- hondacivic = Cars("Honda Civic")
- hondacivic.set_description = ("A fast little 4 cilinder with VTEC")
- hondacivic.describe()
- mercedesgla = Cars("Mercedes GLA")
- mercedesgla.set_description = ("A super elegant cross between urban and offroad")
- mercedesgla.describe()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement