In: Computer Science
Drivers are concerned with the mileage obtained by their automobiles. One driver has kept track of several tankfuls of fuel by recording the kilometres driven and the litres used for each tankful. Develop a python program that prompts the user to input the kilometres driven and litres used for each tankful. The program should calculate and display the kilometres per litre obtained for each tankful. Read inputs for at least 10 such readings. After processing all input information, the program should calculate and print the combined kilometres per litre obtained for all tankfuls (= total kilometres driven divided by total litres used).
Note: program in python.
source code:
kil=0
lit=0
for i in range(10):
k1=int(input("Enter kilometers : "))
l1=int(input("Enter litres for tank : "))
print("number of kilometers for litre : ",(k1/l1))
kil=kil+k1
lit=lit+l1
print("overall number of kilometers for litre : ",(kil/lit))
if you have any doubts ask me...