Прежде всего, ИЗУЧИТЕ ОСНОВЫ
попробуйте взломать цикл
не уверен, если время требуется
for i in range(0, 8):
print("Inputting Data for Lane", i)
gender = str(input("Is the athlete male or female "))
athlete = str(input("What is the athletes name "))
finishTime = float(input("What was the finishing time "))
dataset = [gender, athlete, finishTime]
datasets.append(dataset)
decision = input("Would you like to add another lane ")
if decision != "yes":
break
// следуя вашему коду и тому, что вы спросили
import time
datasets= []
carry_on = True
while carry_on == True:
for i in range(0, 8):
print("Inputting Data for Lane", i)
gender = str(input("Is the athlete male or female "))
athlete = str(input("What is the athletes name "))
finishTime = float(input("What was the finishing time "))
dataset = [gender, athlete, finishTime]
datasets.append(dataset)
decision = input("Would you like to add another lane ")
if decision == "yes":
carry_on = True
else:
carry_on = False
break
print("")
if 3 < i > 9:
print("{0:<10}{1:<10}{2:<15}".format("Gender","Athlete","Finish time"))
ds = sorted(datasets, key=lambda x:x[2], reverse=False)
for s in ds:
time.sleep(1)
print("{0:<10}{1:<10}{2:<15}".format(s[0], s[1], s[2]))
else:
print("You have not chosen enough lanes, please choose atleast 4")