Skip to content

Commit

Permalink
Create 3412.py
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-im-gabriel authored Apr 25, 2023
1 parent c5b4060 commit 5cc05f4
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions 3412.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
N = int(input())

for _ in range(N):
nome = input()
notas = list(map(float ,input().split()))
qtd_notas = len(notas)
p1 = notas[0]
if qtd_notas == 1:
media = (p1 + 0) / 2
elif qtd_notas == 2:
p2 = notas[1]
media = (p1 + p2) / 2
elif qtd_notas == 3:
p2 = notas[1]
p3 = notas[2]
media = (p1 + p2 + p3) / 3
else:
p4 = notas.pop()
menor_nota = min(notas)
if p4 > menor_nota:
indice_menor_nota = notas.index(menor_nota)
notas[indice_menor_nota] = p4
media = sum(notas) / 3
print(f'{nome}: {media:.1f}')

0 comments on commit 5cc05f4

Please sign in to comment.