-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathavaliar_notasDict.py
40 lines (32 loc) · 1 KB
/
avaliar_notasDict.py
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
35
36
37
38
39
40
respostas = {}
notas_maximas = {}
def entrada():
while True:
try:
nome, resposta = input().split()
respostas[nome] = resposta
if nome == "*" or resposta == "*":
break
except:
break
gabarito = input()
for key in respostas:
resultado = 0
for i in range(len(gabarito)):
#print(respostas[key][i], gabarito[i])
if respostas[key][i] == gabarito[i]:
resultado += 1
nota = resultado
if key in notas_maximas:
if nota > notas_maximas[key]:
notas_maximas[key] = nota
else:
notas_maximas[key] = nota
t = float(len(notas_maximas))
media = (float(sum(notas_maximas.values())) / t)
maiorNota = (max(notas_maximas.values()))
menorNota = (min(notas_maximas.values()))
print("Maior:", maiorNota)
print("Menor:", menorNota)
print("Media:","{:.2f}".format(media))
entrada()