Question: python 2.7 please TA Initials (20 Points) Implement the class Car with the following properties. A car has a certain fuel efficiency (measured in miles/gallon)

python 2.7 pleasepython 2.7 please TA Initials (20 Points) Implement the class Car with

TA Initials (20 Points) Implement the class Car with the following properties. A car has a certain fuel efficiency (measured in miles/gallon) and a certain amount of fuel in the gas tank. The efficiency should be specified upon instantiation, and the initial fuel level should be zero. Supply a method called drive that simulates driving the car for a certain distance, which reduces the fuel level in the gas tank. If the car is unable to drive the specified distance, this method should return False. Otherwise, drive should return True. Additionally, supply a method called get-gas.level to return the current fuel level and a method called add gas to add fuel back to the tank. An example of these methods in use is as follows: hybrid-car = Car(50) # 50 miles per gallon hybrid-car, add-gas (20) # Add 20 gallons of fuel if hybrid-car, drive(100): # Drive 100 miles print hybrid-car.get-gas-level() # Display remaining fuel else: print "Not enough gas

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!