Question
Question 1 Imagine that you need to develop a program for athletes at Indiana University. Each practice they run one mile and keep their time
Question 1 Imagine that you need to develop a program for athletes at Indiana University. Each practice they run one mile and keep their time in seconds. They wish to store these times and you are tasked to create a program that will do that for them. You want the script to allow the athletes to do the following tasks: For instance, on the first screen, a user should see the options below that allow s/he to make a selection: 0 - Exit 1 - Add a Time 2 - Show Times 3- Show the Best 3 Times 4- Show the Worst 3 Times 5 - Delete a Time 6 - Sort Times The user needs to type 0, 1, 2, 3, 4, 5, 6 to make a selection. If the input is different than these, the user will see a warning message. See below for more on this.
Based on the users selection, there will be 8 different functions for the following tasks: 1. exit 2. add a time 3. show all the times 4. show the best 3 times (shortest) 5. show the worst 3 times (longest) 6. delete a time 7. sort and show all the times from shortest to longest 8. unknown choice
Part 1 exit The exit function will only give a Good-Bye message. This will be used when the user has done all the wish to.
Part 2 add a time Add_a_time function will add a users times in a list format. For each time input, the user needs to select the add a time option and add the times. For example, running_time= input(Enter the running time) addTime(running_time) This will add running_time to the list. There is nothing returned.
Part 3 list all the times When Show times selected, the list_times function will list all the times on new lines. For example: Running times are: 454
566 563 678 233 Part 4 show the best 3 times (shortest) The user will see the best 3 times in different lines. For example, Your best times are: 233 454 563
Part 5 show the worst 3 times (longest) The user will see the worst 3 times (longest) in different lines. For example, Your longest times are: 678 566 563
Part 6 delete a time The user needs to enter the time value in as an input to remove the value from the list. For example, delete(678)
This will delete 678 from the list of times. There is nothing returned.
Part 7 sort and show all the times from shortest to longest The user will see the times sorted lowest to longest on new lines. For example, Running times are sorted from shortest to longest: 233 454 563 566 678 Part 8 unknown choice When the user enters an option that are not listed in the choices, s/he will see a message that the choice is not a valid choice, and will be asked to enter a new one. For example, Choice: 9 Sorry, but 9 isn't a valid choice.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started