Last part (How is everybody doing ?) something wrong


#1

Hi :slight_smile:

i have something wrong in my code and i don't know why (indentation error maybe ?)

link to "How is everybody doing" - french

thanks for your help :slight_smile:

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)
    return total 
    
def calcule_moyenne(etudiant):
    devoirs = moyenne(etudiant["devoirs"])
    quiz = moyenne(etudiant["quiz"])
    tests = moyenne(etudiant["tests"])
    
    return devoirs * 0.1 + quiz * 0.3 + tests * 0.6
    
def ecrire_lettre_note(note):
    if note >= 90:
        return "A"
    elif note >= 80:
        return "B"
        
    elif note >= 70:
        return "C"
        
    elif note >= 60:
        return "D"
        
    else:
        return "F"
        
    print ecrire_lettre_note(calcule_moyenne(lloyd)) 
    
    
    
def calcule_classe_moyenne(etudiants):
    resultats = [ ]
    
    for etudiants in classe:
        resultats.append(calcule_moyenne(etudiant))
        
        return moyenne(resultats) 
        
etudiants = [lloyd, alice, tyler]        
print calcule_classe_moyenne(etudiants)
print ecrire_lettre_note(calcule_classe_moyenne(etudiants))


#2

i think your fault is in the marked line.
it should be:
for etudiant in etudiants:


#3

Great !! it's finally working ! thanks you :slight_smile:


#4