9/9 Someone want to tell me what's wrong?


#1

Anyone want to tell me what's wrong with this? Cause for someone reason I can't move on
Like I get the tabs because it uploads without them. but that's about it

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

Add your function below!

def get_average(student):
homework=sum(student["homework"])/(len(student["homework"])*1.0)
quizzes=sum(student["quizzes"])/(len(student["quizzes"])*1.0)
tests=sum(student["tests"])/(len(student["tests"])*1.0)
return 0.1*homework+0.3*quizzes+0.6*tests

def get_letter_grade(score):
if score>=90:
return "A"
elif score>=80 and score<90:
return "B"
elif score>=70 and score<80:
return "C"
elif score>=60 and score<70:
return "D"
else:
return "F"
print "alice average: "+str(get_average(alice))

print get_letter_grade(60)

print "lloyd letter-grade: "+ str(get_letter_grade(get_average(lloyd)))

print get_letter_grade(alice)
print get_letter_grade(tyler)
students=[lloyd, alice, tyler]

def get_class_average(students):
results=[]
for student in students:
#print student
results.append(get_average(student))
print "class results array: "+str(results)
avg = (sum(results)/(len(results)*1.0))
print"class average: "+str(avg)
print "Class letter grade: "+ str(get_letter_grade(avg))

get_class_average(students)


#2

here is example you can compare




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


students = [ lloyd , alice ,tyler]


# Add your function below!
def average(numbers):
    total = sum(numbers)
    total = float(total)
    ave = total / len(numbers)
    return  ave
def get_average(student):
    homework = average(student["homework"])
    quizzes = average(student["quizzes"])
    tests = average(student["tests"])
    getave = 0.1 * homework + 0.3 * quizzes + 0.6 * tests
    return getave
def get_letter_grade(score):
    sco= score
    if sco >= 90:
        return   "A"
    elif sco >=80 :
        return  "B"
    elif sco >= 70:
        return "C"
    elif sco >= 60:
        return "D"
    else :
        return "F"
        
lloyd_score = get_average(lloyd)
print get_letter_grade(lloyd_score)

#tao ham get_class_average bien la students 
def get_class_average(students):
    results =[]
    for student in students:
        x = get_average(student)
        results.append(x)
    y = average(results)
    return y
print get_class_average(students)
print get_letter_grade(get_class_average(students))