0
I wanted to do in the notes entry part, and in the final part of showing each student’s grades individually, something similar to what I did in the 'Want to continue? [S/N]', that is, only step forward, if the user enters with a valid number. because the way it is there, if an invalid note is inserted, that is, strings instead of integers, or I ask to see the notes of a student who does not exist in the list, it gives error and closes the program. then wanted to shield him from these bugs. however I tried to use the infinite loop, the loop with stop condition, but nothing works. I wait answer. and follow my code below:
nota = []
aluno = []
while True:
pessoa = input('Nome do aluno: ').capitalize()
while True:
n1 = str(input('Nota 1: '))
if n1.isnumeric == False:
break
while True:
n2 = str(input('Nota 2: '))
if n2.isnumeric == False:
break
aluno.append(pessoa)
nota.append(n1)
nota.append(n2)
aluno.append(nota[:])
geral.append(aluno[:])
aluno.clear()
nota.clear()
while True:
opç = str(input('Quer continuar?[S/N] ')).lower().strip()[0]
if opç in 'sn':
break
if opç == 'n':
break
print(14 * '-=')
print(f'{"Num°":<2}{"Aluno":^10}{"média":>11}')
print(14 * '-=')
for pos,c in enumerate(geral):
print(f'{pos:<6}{str(c[0]):<14}{sum(c[1])/2:3}')
print(14 * '-=')
while True:
num = int(input('De qual aluno deseja saber as notas?[999 para encerrar] '))
if num == 999:
break
print(f'As notas de {geral[num][0]} foram {geral[num][1]}')
print('Volte sempre, tenha um bom dia!')```