Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python Coding Assignment: Create a code to get the following output. Add (#) comments to line of code for explanation A triathlon is an athletic

Python Coding Assignment: Create a code to get the following output. Add (#) comments to line of code for explanation

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

****needs to be in Python and needs a getPosInt(prompt) function and secToMin(s) function****

I have prefilled function arrays with first and last names, and times for events, genders, transition times. just need to know where to put the info in the input and output

## Main entry point of program def main(): # declare parallel arrays and populate with data lastName = getLastNames() # holds the last names of the participants firstName = getFirstNames() # holds the first names of the participants division = getDivisions() # holds the age group assignment for standard and sprint swimTimes = getSwimTimes() # holds the swim times in seconds transition1Times = getT1Times() # holds the transition I times in seconds cycleTimes = getCycleTimes() # holds the cycling times in seconds transition2Times = getT2Times() # holds the transition II times in seconds runTimes = getRunTimes() # holds the runTimes in seconds event = getEvent() # holds the event id. 1 = standard tri, 2 = sprint tri gender = getGender() # holds the gender of the participant

numToDisplay = 0 # holds the number of participants to display ttl = 0 # total time accumulator in loop

############################################################# # Complete the following line of code for max array length ############################################################# numOfParticipants = len(getLastNames()) # holds the max index number for the arrays

### input phase # Use a while loop to ask user how many participants they want to display # if the response is too large, print "Your entry exceeds the number of participants! Please try again!" while True: inp= int(input("How many participants do you wish to display? ")) if inp>numOfParticipants: print("Your entry exceeds the number of participants! Please try again!") else:

for i in range(len(numOfParticipants)):

### output phase # output the demographic information: First and Last Name, Division, Event, and Gender # output the time metrics

### call main to run program main() this is the the code I have so far

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced MySQL 8 Discover The Full Potential Of MySQL And Ensure High Performance Of Your Database

Authors: Eric Vanier ,Birju Shah ,Tejaswi Malepati

1st Edition

1788834445, 978-1788834445

More Books

Students also viewed these Databases questions

Question

4 How can you create a better online image for yourself?

Answered: 1 week ago

Question

What is group replacement? Explain with an example. (2-3 lines)

Answered: 1 week ago

Question

3. You can gain power by making others feel important.

Answered: 1 week ago