A swimmer swims a distance of 100m 5 times. Each time the swimmer swims 100, the time is recorded in an array.
A program is needed that will process an array of swim times. It will calculate the average time of the 5 recorded values.
A programmer has attempted a solution:
There are no syntax errors.
However the program doesn't calculate the correct total. And it doesn't calculate the average.
Adapt the code so that it works as expected.
An integer array stores 10 swim times recorded for 1 swimmer.
Write a program that will ask the user to enter a time eg 55. The program will display a count of all times in the dataset that are lower than the time entered.
Use this code to validate the user entry. Only times between 49 and 60 can be entered into the system. The system will keep asking for a valid time until one is entered.
while userEntry <49 or userEntry>60:
userEntry = int(input("Invalid entry! try again"))
Write this program.
Two swimmers, Suzie and Marie, swim 100m 5 times.
Their results are stored in seperate arrays.
A sports analyst wants to compare who was faster for any of the 5 attempts.
Write a program that will ask a user to enter a swim number, 1-5
The program will display the name of the swimmer who was quickest for that swim number, along with the fastest time in that swimmer's data set.
For example, here is Suzie's data set:
[55.3, 54.7, 56.1, 55.0, 52.9]
and this is Marie's data set:
[52.3, 54.6, 54.1, 52.6, 51.9]
and the user wanted to compare the third swim number, the system would print:
"Marie swam fastest: 54.1 (51.9)"
Write this program.