Question

In: Computer Science

Write a program to compute the total time and average speed it will take a runner...

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

Solutions

Expert Solution


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!


Related Solutions

We have a list of runner and their running time, write a program in Java to...
We have a list of runner and their running time, write a program in Java to show the fastest runner and their time.
Write the following java program: Desc Output the name and time of the runner who came...
Write the following java program: Desc Output the name and time of the runner who came in first, as well as the name and time of the runner who came in last in a marathon race (assuming there are no ties). Input A text file named marathon.txt containing the name and time of each participant in the following format (the file has at least 1 participant, name is just 1 word with no space, and name and time are separated...
For this C++ program, Write and modify the code to compute and display the class average...
For this C++ program, Write and modify the code to compute and display the class average as well as the standard deviation. Your code changes are as follows: 1. The variable “double grade” should be replaced by a two-dimensional array variable “double grade[NUMSTUDENTS][NUMGRADES].” Also replace the variable “double average” by “double average[NUMSTUDENTS].” This is necessary since you need to save the entered grades specially to compute the standard deviations. 2. After completing the display of the average grade of all...
Write a program named Intervals.java that will take two time intervals (a starting and ending time)...
Write a program named Intervals.java that will take two time intervals (a starting and ending time) and compare them. The program first prompts the user for an earlier and later interval. Each interval consists of two numbers in 24-hour format (for example, 1507 for 3:07 p.m.): Enter earlier start and end time as two 24-hour format times: 0700 1045 Enter later start and end time as two 24-hour format times: 0815 1130 You may presume that the user will enter...
Problem: You will write a program to compute some statistics based on monthly average temperatures for...
Problem: You will write a program to compute some statistics based on monthly average temperatures for a given month in each of the years 1901 to 2016. The data for the average August temperatures in the US has been downloaded from the Climate Change Knowledge Portal, and placed in a file named “tempAugData.txt”, available on the class website. The file contains a sequence of 116 values. The temperatures are in order, so that the first one is for 1901, the...
Write a program(Java) to compute modular exponentiation: take g (base), e (exponent), and, N (modulas) as...
Write a program(Java) to compute modular exponentiation: take g (base), e (exponent), and, N (modulas) as input from the user and output the result. Use an online compiler. Do not use the inbuilt functions to compute this. Also, try to make the program as efficient as possible. In particular, please implement the square and multiply algorithm discussed in the class.

Using C++ code, write a program named q3.cpp to compute the total amount of medicine m...
Using C++ code, write a program named q3.cpp to compute the total amount of medicine m absorbed by a rabbit, where the rabbit gets 2 pills containing n1 and n2 grams of medicine, respectively, of which the rabbit absorbs 60% and 35%, respectively, and n1 and n2 are input by a user via the keyboard.  
Using C++ code, write a program named q3.cpp to compute the total amount of medicine m...
Using C++ code, write a program named q3.cpp to compute the total amount of medicine m absorbed by a rabbit, where the rabbit gets 2 pills containing n1 and n2 grams of medicine, respectively, of which the rabbit absorbs 60% and 35%, respectively, and n1 and n2 are input by a user via the keyboard.
Calculate the average speed, collision frequency, average free travel and the total number of shocks for...
Calculate the average speed, collision frequency, average free travel and the total number of shocks for 1 mole of nitrogen found in a 0.5 L container at a temperature of 280 K. (σ = 0.4 nm2)
In a relay race, runner A is carrying the baton and has a speed of 2.60...
In a relay race, runner A is carrying the baton and has a speed of 2.60 m/s. When he is 25.0 m behind the starting line, runner B starts from rest and accelerates at 0.0600 m/s2. How long afterwards will A catch up with B to pass the baton to B?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT