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