Question
Python Coding Assignment: A triathlon is an athletic contest consisting of three different events, typically swimming, cycling, and longdistancing running. Write a program that will
Python Coding Assignment:
A triathlon is an athletic contest consisting of three different events, typically swimming, cycling, and longdistancing running. Write a program that will prompt and accept the number of participants in a triathlon whose data is to be presented. For example (Interaction):
How many participants do you wish to display? 2 Name: Jeff Adrian Division: M4044 Event: Standard Triathlon: 1.5km Swim, 40km Bike, 10km Run Gender: Male Swim: 33.77 minutes Transition 1: 5.48 minutes Bike: 77.08 minutes Transition 2: 0.58 minutes Run: 64.12 minutes Total: 181.03 minutes Name: Jacob Adserballe Division: M4549 Event: Standard Triathlon: 1.5km Swim, 40km Bike, 10km Run Gender: Male Swim: 29.47 minutes Transition 1: 3.73 minutes Bike: 70.35 minutes Transition 2: 0.23 minutes Run: 48.03 minutes Total: 151.82 minutes
Notice that all the times are displayed to two (2) significant digits
--------------------------------------------------------------------------------------
MUST FOLLOW THESE GUIDELINES
A. Create a function named getPosInt(prompt). This function prompts the user for input, process it for errors and valid data, and returns a positive integer. ii. This function has the argument prompt, which is used to supply a prompt to the user. iii. This function returns a positive non-zero integer iv. This function must use a while loop to prompt the user for additional attempts if he or she enters erroneous data. v. This function must use a try and except block to handle exceptions resulting from erroneous input vi. This function returns a valid integer vii. This function never uses break or exit() B. Create a function named secToMin(s). This function converts seconds to minutes. i. Place this function after getPosInt(prompt) ii. This function has the parameter s, which is used to pass in seconds iii. This function calculates minutes from seconds and returns the result 3
A. Complete the code which sets the value for the variable numOfParticipants to the length of the lastNames array. A. Use a while loop to ask the user how many participants they want to display. If the response is larger than the length of the lastNames array, then print, Your entry exceeds the number of participants! Please try again! A. The output must use a for loop B. The output must look identical to the example provide a
-----------------------------------------------------------------------------
Lastly, have (#) comments for lines of codes and or formulas
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