Question
A program is being written to calculate and print average km per litre petrol (mileage) for a car after five petrol fill-ups. Assume that we
A program is being written to calculate and print average km per litre petrol (mileage) for
a car after five petrol fill-ups. Assume that we start with a full-tank and each time at the
filling, we fill the tank fully. Inputs are: Odometer reading at the starting, Odometer
reading, one by one, at the time of each filling, and amount of petrol filled, one by one,
at the time of each filling. Outputs: At each filling, print the mileage for that filling: At the
end print the overall average mileage. Use Loop.
For this program, write PAC, Algorithm and flow chart. Show the iteration table.
Note :complete by using python only
Example: We start with full tank and Odometer reading: odometer_first-3000. At filling place 1: Odometer-3200: petrol_filled-5 lit; so mileage (3200-300)/5 (print) At filling place 2: Odometer=3450; petrol_filled-6 lit; so mileage=(3450-3200)/6 (print)
Finally overall average mileage = (Odometer_last-Odometer_start)/(total petrol filled)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started