#01 - The Athletes Problem
Flowchart
Pseudocode
Code
times=[]
print('times in the 400M sprint')
def get_gender():
while True:
gender=str(input('Is this Male, Female or Other? (M/F/O)\n')).upper()
if gender!='M' and gender!='F' and gender!='O':
print('Error, please input M, F or O')
else:
return gender
def get_number_of_athletes():
number_of_athletes=int(input('How many athletes are there?\n'))
return number_of_athletes
def finishing_times(number_of_athletes,gender):
for x in range(number_of_athletes):
times.append(float(input('Enter the finishing time of the athlete: ')))
times.sort()
print('the fastest time was',times[0])
if gender=='F':
if times[0]<45.7:
print('That is the new female World Record')
else:
print('well done!')
elif gender=='M':
if times[0]<48.3:
print('this is the new male World Record')
else:
print('well done!')
else:
if times[0]<43.8:
print('That is the new other World Record')
else:
print('well done!')
gender=get_gender()
finishing_times(get_number_of_athletes(),gender)