Specification In your hws.py define the class Car that has the following attribu
ID: 3741542 • Letter: S
Question
Specification In your hws.py define the class Car that has the following attributes . make model year The class must have the following methods get make () get model () get_year () print_car () get make () This method returns the value of the make attribute get model () This method returns the value of the mode1 attribute get_year ) This method returns the value of the year attribute print car This method prints a string consisting of the value of the make attribute, followed by a comma and a space, the value of the model attribute, followed by a comma and a space, and the value of the year attribute Test Code Your script must contain the following test code carCar ("Honda", "CRV","1997") print (car.get_make) print (car.get_model ()) print (car.get year()) car.print_car() Testing When you run your script, your output should look this this Honda CRV 1997 Honda, CRV, 1997Explanation / Answer
# i have checked by running the code, if any issue , can comment.
# declare a class
class Car:
"""
"""
def __init__(self, model, make, speed):
"""
"""
self.make = make
self.model = model
self.speed = speed
def get_make(self):
return self.make
def get_model(self):
return self.model
def get_speed(self):
return self.speed
"""
"""
if __name__ == '__main__':
car = Car('2009', 'ford ranger', 25)
print("Car Info: ")
print("model: %s" % car.get_model())
print("make: %s" % car.get_make())
print("speed: %d" % car.get_speed())
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.