# How is everybody doing?

#1
``````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
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)
``````

One of the following is missing or broken when we tried to use it: alice, lloyd, tyler, students, get_class_average, get_letter_grade

I don’t get what to do at this point…

#2

What error do you get?.

#3

One of the following is missing or broken when we tried to use it: alice, lloyd, tyler, students, get_class_average, get_letter_grade

#4

Sometimes you should also post the instruction to get a better understanding if you didn’t understand it. If I’m correct your instruction says

``````1.Write a function average that takes a list of numbers and returns the average.
Define a function called average that has one argument, numbers.
Inside that function, call the built-in sum() function with the numbers list as a parameter. Store the result in a variable called total.
Like the example above, use float() to convert total and store the result in total.
Divide total by the length of the numbers list. Use the built-in len() function to calculate that.
Return that result.
``````

I don’t see your `total` variable, and your float should be your `total` variable not `len()` function, so when your function gets to the point where average is called and the interpreter runs your code it doesn’t get what it expected or wants, no total variable.

#5

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