In a distance jumping competition, each athlete is entitled to five jumps. The athlete's score will be determined by the average of the remaining five values. You must make a program that receives the name and the five distances reached by the athlete in his jumps and then inform the name, the jumps and the average of the jumps. The program must be terminated when the athlete's name is not entered.
You're giving this line error
print(nsaltos[j],todosaltos[i[j]]," m")
builtins.TypeError: 'int' object is not subscriptable
nsaltos = ['Primeiro Salto: ','Segundo Salto: ','Terceiro Salto:
','Quarto Salto: ','Quinto Salto: ']
atletas = []
saltos = []
todosaltos = []
nome = 0
media = 0
lstsalto = ""
while True:
nome = str(input("Digite o nome: "))
atletas.append(nome)
if nome == '':
break
for i in range(5):
distancia = float(input("Digite a distancia %d: "%(i+1)))
saltos.append(distancia)
todosaltos.append(saltos)
saltos = []
atletas.pop(len(atletas)-1)
for i in range(len(atletas)):
print("Atleta: ",atletas[i])
print("")
for j in range(len(todosaltos[i])):
print(nsaltos[j],todosaltos[i[j]]," m")
media += todosaltos[i[j]]
convsalto = str(todosaltos[i[j]])+" -"
lstsalto += convsalto
print("Resultado final:")
print("Atleta: ",atletas[i])
print("Saltos: ",lstsalto)
print("Média dos saltos: ",(media/5)," m")
media = 0
lstsalto = ""