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

-Language used is Python. Please form the code for this scenario.

Solutions

Expert Solution

total_kilometres = 0

total_litres = 0

# Read inputs for at least 10 such readings.

for i in range(10):

    print(f"For tankful #{i+1}")

    # prompts the user to input the kilometres driven

    kilometres = int(input("\nEnter kilometres driven: "))

    # prompts the user to input the litres used for each tankful.

    litres = int(input("Enter litres used: "))

    total_kilometres += kilometres

    total_litres += litres

    # calculate and display the kilometres per litre obtained for each tankful.

    print("\nkilometres per litre is obtained for this tankful:", kilometres/litres)

# print combined output

print("\ncombined kilometres per litre:",

      round(total_kilometres/total_litres))

.

Screenshot:

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...
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 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.
Two carts mounted on an air track are moving toward one another. Cart 1 has a...
Two carts mounted on an air track are moving toward one another. Cart 1 has a speed of 4.40 m/s and a mass of 0.530 kg. Cart 2 has a mass of 0.710 kg. a) If the total momentum of the system is to be zero, what is the initial speed of cart 2? b) Does it follow that the kinetic energy of the system is also zero since the momentum of the system is zero? c) Determine the system's...
The “standard” bagel has always been the one obtained by rotating the circle of radius 3/4...
The “standard” bagel has always been the one obtained by rotating the circle of radius 3/4 inch centered at (3/4 , 0) around the line x = −1. Recently, a Californian chef created a bagel with the same circle but rotated around the line x = −2. (a) Physically, what’s the difference between the two bagels? (b) What are the volumes of the standard and Californian bagels?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT