Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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 miles

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MySQL/PHP Database Applications

Authors: Brad Bulger, Jay Greenspan, David Wall

2nd Edition

0764549634, 9780764549632

More Books

Students also viewed these Databases questions

Question

Explain all drawbacks of the application procedure.

Answered: 1 week ago

Question

Determine Leading or Lagging Power Factor in Python.

Answered: 1 week ago

Question

1. Describe the factors that lead to productive conflict

Answered: 1 week ago