Copy and paste the following definition of theclass Car in the submission box and then add a method calledbrake which decreases the speed by 5.
class Car:
def __init__(self,year,make): self.year = year self.make = make self.speed = 20
def getSpeed(self): return self.speed
def accelerate(self): self.speed += 5
this is for python.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here