-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex89.py
More file actions
34 lines (27 loc) · 1019 Bytes
/
Copy pathex89.py
File metadata and controls
34 lines (27 loc) · 1019 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
lista = [[], [], [], []]
while True:
nome = str(input('Digite o nome do aluno: '))
lista[0].append(nome)
nota1 = int(input(f'Digite a nota 1 do {nome}: '))
lista[1].append(nota1)
nota2= int(input(f'Digite a nota 2 do {nome}: '))
lista[2].append(nota2)
media = (nota1 + nota2) / 2
lista[3].append(media)
opc = str(input('Quer continuar? S/N')).upper().strip()
if opc == 'N':
break
print('\n-_-_-_-_ALUNOS E SUAS MÉDIAS_-_-_-_-')
for nome, media in zip(lista[0], lista[3]):
print(f"{nome} e sua media eh {media:.1f}")
while True:
opc2 = int(input("Qual aluno? (1, 2, 3...) ou 999 para sair: "))
if opc2 == 999:
break
# Converter posição do usuário para índice Python
indice = opc2 - 1
# Validar se o índice existe
if 0 <= indice < len(lista[0]):
print(f"{lista[0][indice]} - Nota 1: {lista[1][indice]}, Nota 2: {lista[2][indice]}")
else:
print("Aluno não existe!")