# Probleme with average HELP

#1

student become professor

calcule_moyenne(alice) induit l'erreur suivante : global name 'average' is not defined

``````lloyd = {
"noms": "Lloyd",
"devoirs": [90.0, 97.0, 75.0, 92.0],
"quiz": [88.0, 40.0, 94.0],
"tests": [75.0, 90.0]
}
alice = {
"noms": "Alice",
"devoirs": [100.0, 92.0, 98.0, 100.0],
"quiz": [82.0, 83.0, 91.0],
"tests": [89.0, 97.0]
}
tyler = {
"noms": "Tyler",
"devoirs": [0.0, 87.0, 75.0, 22.0],
"quiz": [0.0, 75.0, 78.0],
"tests": [100.0, 100.0]
}

# Ajoutez votre fonction ci-dessous !

def moyenne(nombres):
total=sum(nombres)
total=float(total)
total = total/len(nombres)

def calcule_moyenne(etudiant):
devoirs = average(etudiant['devoirs'])
quiz  = average(etudiant['quiz'])
tests = average(etudiant['tests'])
return 0.1*devoirs + 0.3*quiz + 0.6*tests``````

#2

HI where you put average you should put moyenne here

``````    devoirs = average(etudiant['devoirs'])
quiz  = average(etudiant['quiz'])
tests = average(etudiant['tests'])``````

#3

thks it works now

#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.