get_average(frank) shows this error: get_average(mary) returned 84.15 instead of 91.15


#1

Hi! I don't understand this, please if someone can help me, i will appreciate it. Here is my code:

angelina = {
"name": "Angelina",
"homeworks": [90.0, 97.0, 75.0, 92.0],
"quizzes": [88.0, 40.0, 94.0],
"tests": [75.0, 90.0]
}
mary = {
"name": "Mary",
"homeworks": [100.0, 92.0, 98.0, 100.0],
"quizzes": [82.0, 83.0, 91.0],
"tests": [89.0, 97.0]
}
frank = {
"name": "frank",
"homeworks": [0.0, 87.0, 75.0, 22.0],
"quizzes": [0.0, 75.0, 78.0],
"tests": [100.0, 100.0]
}

students = [angelina,mary,ramiro]

¡Agregá tu función acá abajo!

def promedio(numeros):
numeros = [homeworks,quizzes,tests]
total = sum(numeros)
float(total)
return total/len(numeros)

def sacar_promedio(alumno):
for alumno in alumnos:
tareas = promedio(alumno["tareas"])
pruebas = promedio(alumno["pruebas"])
examenes = promedio(alumno["examenes"])
return tareas*0.1 + pruebas*0.3 + examenes*0.6


#2

I don't think that you should have : numeros = [homeworks,quizzes,tests]
use total=sum(numeros)
total=float(total)
return total/len(numeros)

This was my code :
def get_average(student):
homework=average(student["homework"])
quizzes=average(student["quizzes"])
tests=average(student["tests"])

return 0.10*average(student["homework"])+ \
0.30*average(student["quizzes"])+ \
0.60*average(student["tests"])

The last return will give you the averages. You use Spanish words, so change student=alumno etc.


#3

I don't think that you should have : numeros = [homeworks,quizzes,tests]
use total=sum(numeros)
total=float(total)
return total/len(numeros)

This is what I wrote:

def get_average(student):
homework=average(student["homework"])
quizzes=average(student["quizzes"])
tests=average(student["tests"])

return 0.10*average(student["homework"])+ \
0.30*average(student["quizzes"])+ \
0.60*average(student["tests"])

The last return will give you the averages. You use Spanish words, so change student=alumno etc.