Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please write in Python 3 Bill and Ted are taking a road trip. But the odometer in their car is broken, so they don't know
Please write in Python 3
Bill and Ted are taking a road trip. But the odometer in their car is broken, so they don't know how many miles they have driven. Fortunately, Bill has a working stopwatch, so they can record their speed and the total time they have driven. Unfortunatelv, their record keeping strategy is a little odd. so thev need help computing the total distance driven. You are to write a program to do this computation For example, if their log shows per hour Total elapsed 2 Speed in miles 20 30 10 time in hours 7 this means they drove 2 hours at 20 miles per hour, then 6-2-4 hours at 30 miles per hour, then 7-6-1 hour at 10 miles per hour. The distance driven is then (2) (20) + (4)(30) + (1)(10) 40120 10 170 miles. Note that the total elapsed time is alwavs since the beginning of the trip, not since the previous entrv in their log. Input Each line of the input will consist of two values: the speed (in miles per hour) and a timestamp (in hours). The input will end with a line that says "Done". Note all of the speeds and times will be positive integers Output The output should the the total distance driven with units, for example 180 miles Example sessions 20 2 30 6 10 7 Done 170 milesStep 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