-1
The code should receive a number of student grades, print the grade average and how many grades are 10% below and 10% above average. The code is like this:
quantidade = int(raw_input())
inicio = 0
ListaDeNotas = list()
while quantidade > inicio:
notas = int(raw_input())
inicio = inicio + 1
ListaDeNotas.append(notas)
MediaDasNotas = sum(ListaDeNotas) / len(ListaDeNotas)
print ("%.2f" % MediaDasNotas)
Notas10Acima = list()
Notas10Abaixo = list()
for nota in ListaDeNotas:
if nota > ((0.1 * MediaDasNotas) + MediaDasNotas):
Notas10Acima.append(nota)
elif nota < (MediaDasNotas - (0.1 * MediaDasNotas)):
Notas10Abaixo.append(nota)
print len(Notas10Acima)
print len(Notas10Abaixo)
Example of how it should work: Entree:
5
23
12
45
24
28
Exit:
26.40
1
2
My code should print the average 26.40
, for these values, but prints 26.00
. Where am I going wrong?
Why the negative votes?
– Guilherme Santana De Souza