# Lesson 9 How is everybody doing can some one help me

#1

Below is my code. the error is "ONE OF THE FOLLOWIING IS MISSING OR
BROKEKN ETC " but on the console it is typing B , 83.86 , NONE

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]
}

def average(numbers):
total = sum(numbers)
total = float(total)

def get_average(student):
homework = average(student["homework"])
quizzes = average(student["quizzes"])
tests = average(student["tests"])
return 0.1 * homework + 0.3 * quizzes + 0.6 * tests

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(students):
results = []
for student in students:
results.append(get_average(student))
return average(results)

print get_class_average([lloyd, alice, tyler])

#2

First of all, it really would have been cool if you formatted your code since python is indentation sensitive, to say.

That said, it is okay you put all the students in a list and called them here:

However, you looped for students list here

And you didn't create that list explicitly.

You could simply do that like this:

``students = [lloyd, alice, tyler]``

Hope this helps!

#3

Thanks for the help . but it is still giving the same error.I revised the code as below.I am very much frustrated as this is the last lesson to complete the PYTHON
course and could not find any suitable code to get through from DISCUSSION FORUM.I would request you to write the code specific to this to enable me to get through.
students [lloyd, alice, tyler]
print get_class_average(students)

#4

I am getting the following Error and what is the solution to get rid of this error.The following message is in addition of the above message.
Oops, try again. One of the following is missing or broken when we tried to use it: alice, lloyd, tyler, students, get_class_average, get_letter_grade

#5

Okay, here is 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]
}

def average(numbers):
total = sum(numbers)
total = float(total)
total/=(len(numbers))

def get_average(student):
homework = average(student["homework"])
quizzes = average(student["quizzes"])
tests = average(student["tests"])
return 0.10*homework + 0.30*quizzes + 0.60*tests

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(students):
results = []
for student in students:
results.append(get_average(student))
return average(results)

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

#6

I am confused about this. get_letter_grade(score) should be passed in a integer or a float, but lloyd is a dictionary. And the fuction get_average() is not excuted, where did the score come from?

#7

Thx it works
why it differ from didn't think that they need a list for Students

#8

If I get you right, it won't work since the for loop was looping for a student in students but wasn't available.

#9

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