Adding a .drive() Method (Challenge)
So that means that you should be able to drive a car. So, whatever mileage it has, if you call
.drive() on it and pass it an integer, its
.mileage instance attribute should be incremented by that number.
Then you can test it by instantiating a
0 miles and then call
.drive(), passing it
100. And finally, then also print the
.mileage attribute to check that it’s actually now set to
0 anymore as you instantiated it.
Become a Member to join the conversation.