In: Computer Science
Write a program to compute the total time and average speed it will take a runner to run 10 miles with the following pace segments:
they run the first mile at a pace of 7 minutes per mile, the following 4 miles at a pace of 8.5 minutes per mile, the next 4 miles at a pace of 9 minutes per mile and the last mile at a pace of 3.5 minutes per mile.
Performs the computations and prints the results in a single nice message
Language PYTHON3
first_mile_pace = 7.0
two_to_five_pace = 8.5
six_to_nine_pace = 9.0
last_mile_pace = 3.5
total_time = (first_mile_pace*1) + (two_to_five_pace*4) + (six_to_nine_pace*4) + (last_mile_pace*1)
average_speed = float(10/total_time)
print("The total time is",total_time,"minutes and average speed
is", average_speed,"miles per minute")
Output:
Hope you like it!
Please provide comments if you have any doubts!