Question

In: Computer Science

Drivers are concerned with the mileage obtained by their automobiles. One driver has kept track of...

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).

It must be in Python

Solutions

Expert Solution

Python code:

#accepting kilometres driven
km=float(input("Enter kilometres driven(-1 to quit): "))
#initializing total_km as 0
total_km=0
#initializing total_litre as 0
total_litre=0
#looping till km entered is -1
while(km!=-1):
#accepting litres used
litre=float(input("Enter litres used: "))
#printing Kilometres per litre
print("Kilometres per litre:",km/litre)
#adding km to total_km
total_km+=km
#adding litre to total_litre
total_litre+=litre
#accepting kilometres driven
km=float(input("Enter kilometres driven(-1 to quit): "))
#printing Total kilometres per litre
print("Total kilometres per litre:",total_km/total_litre)


Screenshot:


Input and Output:


Related Solutions

Drivers are concerned with the mileage obtained by their automobiles. One driver has kept track of...
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...
Drivers are concerned with the mileage obtained by their automobiles. One driver has kept track of...
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...
Drivers are concerned with the mileage obtained by their automobiles. One driver has kept track of...
Drivers are concerned with the mileage obtained by their automobiles. One driver has kept track of several trips by recording miles driven and gallons used for each trip. Develop a java program that uses a while statement to input the miles driven and gallons used for each trip. The program should calculate and display the miles per gallon obtained for each trip and print the combined miles per gallon obtained for all tankfuls up to this point. Enter miles driven...
Performance Measurement – MCE – Chapter 11 Management of the Linden Co. has kept track of...
Performance Measurement – MCE – Chapter 11 Management of the Linden Co. has kept track of the process time to complete an order. The following average times for the most recent month.                                            Days Wait time                         7.4 Inspection time               .6 Process time                    2.1 Move time                          .7 Queue time                      3.5 Compute the following: Delivery cycle time Throughput time Manufacturing cycle efficiency What percentage of time is spent on non-value-added activities?
An analyst has kept track of number of defect produced by five workers on five different...
An analyst has kept track of number of defect produced by five workers on five different machines the result are shown below for a run of 400 units per machine M1 M2 M3 M4 M5 1 1 7 4 8 2 2 7 4 5 2 1 3 3 4 3 2 3 4 9 2 8 8 5 5 0 3 2 4 3 USE excel and determine the set of assisments that will minimize the toatal number of...
A professor has kept track of test scores for students who have attended every class and...
A professor has kept track of test scores for students who have attended every class and for students who have missed one or more classes. below are scores collected so far. perfect: 80,86,85,84,81,92,77,87,82,90,79,82,72,88,82 missed 1+:61,80,65,64,74,78,62,73,58,72,67,71,70,71,66 1. Evaluate the assumptions of normality and homoscedasticity 2. conduct a statistical test to assess if exam scores are different between perfect attenders and those who have missed class 3. What is the meaning of the 95% confidence interval given from the R code. What...
.A machine cost $200,000 and has a salvage value of $100,000 if kept for one year....
.A machine cost $200,000 and has a salvage value of $100,000 if kept for one year. The salvage value will decrease by $50,000 in years 2 and 3 and remain zero after year 3. The operating costs are $50,000 the first year and increase by $50,000 per year. So operating costs in year two will be $100,000, and in year three $150,000 and so on. How long should the equipment be kept so that annual cost is minimized if the...
4.A machine cost $200,000 and has a salvage value of $100,000 if kept for one year....
4.A machine cost $200,000 and has a salvage value of $100,000 if kept for one year. The salvage value will decrease by $50,000 in years 2 and 3 and remain zero after year 3. The operating costs are $50,000 the first year and increase by $50,000 per year. So operating costs in year two will be $100,000, and in year three $150,000 and so on. How long should the equipment be kept so that annual cost is minimized if the...
The maker of Tangerine automobiles has two assembly plants: the one in Metropolis producers 36% of...
The maker of Tangerine automobiles has two assembly plants: the one in Metropolis producers 36% of the vehicles; and the one in Gotham produces the other 64% of the vehicles. They then all are shipped to a distribution site, where they undergo extensive quality tests. It seems that 85% of the vehicles from Metropolis pass the test; but only 75% of vehicles from Gotham pass the test. a- What is the probability that a randomly chosen vehicle shipped to the...
One of the girls on your college track team has diabetes. She has shared with you...
One of the girls on your college track team has diabetes. She has shared with you some of her fears and concerns. You ask her if you can share this information with the other team members and she gives you the permission to do so. Design a lecture for the team members that will help them recognize the signs, symptoms, and complications of diabetic problems.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT