Objective
Develop a Python program that implements an interface called IVehicle. In Python an interface is an abstract class (abc.ABC) whose methods are all abstract.
Instructions
IVehiclehas two methods:drive(), which displays nothing and returns nothing, andrefuel(gasoline_amount), which receives the amount of gasoline and returnsTrueorFalse.- Create a class
Carthat implementsIVehicle. Its constructor receives the initial amount of gasoline. drive()shows that the car is driving if the gasoline is greater than 0.refuel()increases the gasoline of the car and returnsTrue.- In the main program, create a
Carwith 0 gasoline, ask the user for the amount of gasoline to refuel, refuel the car and finally calldrive().
15
Refueling successful. Current gasoline level: 15
Attempting to drive the car:
The car is driving.
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise