Student becomes the teacher 9 answer


#1

hw_weighting = 0.1
test_weighting = 0.6
quiz_weighting = 0.3

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],
"tests": [89.0, 97.0],
"quizzes": [82.0, 83.0, 91.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 average(x):
param_instance = len(x)
param_sum = float(sum(x))
ave_product = param_sum/param_instance
return ave_product

def get_average(student):
qz_weight = average(student["quizzes"]) * .3
hw_weight = average(student["homework"]) * .1
tst_weight = average(student["tests"]) * .6
tot_weight = qz_weight + hw_weight + tst_weight
return tot_weight

def get_letter_grade(score):
if score >= 90:
return "A"
elif score < 90 and score >= 80:
return "B"
elif score < 80 and score >= 70:
return "C"
elif score < 70 and score >= 60:
return "D"
elif score < 60:
return "F"

print get_letter_grade(get_average(lloyd))

def get_class_average(students):
results = []
for student in students:
results.append(get_average(student))
return average(results)

students = [lloyd,alice,tyler]
def average(data):
return sum(data) / float(len(data))
def get_average(student):
return average(student["homework"]) * 0.1 + average(student["quizzes"]) * 0.3 + average(student["tests"]) * 0.6
def get_letter_grade(score):
if score >= 90:
return "A"
elif score >= 80:
return "B"
elif score >= 70:
return "C"
elif score >= 60:
return "D"
else:
return "F"
def get_class_average(class_list):
sumavg = 0
for student in class_list:
sumavg += get_average(student)
return sumavg / float(len(class_list))
print get_class_average(students)
print get_letter_grade(get_class_average(students))


#2

Thanks Curtoise ...................................................... lol


#3

Nice zebra ggggggggggggggggggggggggggggggggggg