An Athletics club is planning to create an app to record the lap time of different runners during a 400 x 4 relay race. Their app will capture and store the names of the runners involved in the relay race and record the lap times of each runner.
Their app will then be used to generate more information using the recorded data such as:
- The overall time it took for the runners to complete the relay race.
- The average lap time calculated using the recorded lap times of each runner.
In the code provided below, you will find that the names and lap times of each runner are stored in the code using two lists called names and times.
runners = ["Alina","Rafael","Sid","Suraya"] times = ["1:24","1:45","1:33","1:39"]
In the times list, lap times are expressed in minutes:seconds. For instance Alina completed her lap in 1 minute and 24 seconds whereas Rafael completed his lap in 1 minute and 45 seconds.
Then the following code is used to loop through each values in each list to display the lap time of each runner.
#Retrieve the number of runners involved in the race (e.g. 4) numberOfRunners = len(runners) for i in range(0,numberOfRunners): print(runners[i] + " completed a lap in " + times[i])
Your Task
Your task will be to complete the code provided below so that your Python program automatically calculates the overall time it took these 4 runners to complete the 4 x 400m relay to then work out the average lap time amongst these four runners. Make sure the overall time and the average time are given in the minutes:seconds format.
Tip?
Revealing this tip is optional! Only reveal it if you are not sure how to get started with this task!
Python Code
Complete the code below…
Solution...
The solution for this challenge is available to full members!Find out how to become a member:
➤ Members' Area