Python While traveling home for the holiday, you wondered how much time you'd save if you drove...

50.1K

Verified Solution

Question

Programming

Python

While traveling home for the holiday, you wondered how much timeyou'd save if you drove faster. The distance home is 120 miles, andyou decided to compare driving 55 mph versus 70 mph. You alsowondered if driving faster around town really saves you that muchtime. The around-town distance you chose was 5 miles, using speedsof 25 and 35 mph. Of course, you decided that no amount of timessavings is worth the risk to yourself or others, but you stillwanted to find the answer.

Create two functions to help calculate the travel time in hours,minutes and seconds and to display the results.

# Calculate travel time in minutes given the distance in miles and the speed in mphcalc_travel_time ( distance, speed )# Output the travel time hours, minutes and seconds given distance and speedprint_travel_time ( distance, speed )

Your Python solution must include the following:

  • The calc_travel_time() function will returnthe travel time in minutes
  • The print_travel_time() function will use(call) the calc_travel_time() function, and willdetermine the actual time in hours, minutes and seconds, using theint() and round() Pythonfunctions
  • Include the single line comment above each function
  • Comment the test section of your program
  • Include the standard class ''' comment section at the top ofyour file
  • Include a section called References that lists the web sitereference link

Tip:

Expected output:

To travel 120 miles at 55 MPH will take 2 hr, 10 min and 55 secTo travel 120 miles at 70 MPH will take 1 hr, 42 min and 51 secTo travel 5 miles at 25 MPH will take 0 hr, 12 min and 0 secTo travel 5 miles at 35 MPH will take 0 hr, 8 min and 34 sec

Answer & Explanation Solved by verified expert
4.0 Ratings (565 Votes)
Given below is the code for the question Ensure to indent asshown in image Please do rate the answer if it helped Thankyou    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students