# Andy and hasty

#1

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 = total / len(numbers)

student = lloyd, alice, tyler

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.0:
return "A"
elif score >= 80.0:
return "B"
elif score >= 70.0:
return "C"
elif score >= 60.0:
return "D"
else:
return "F"

def get_class_average(students):
results = []
for student in students:
results.append(get_average(student))
return average(results)
students = [alice, lloyd, tyler]
print get_class_average(student)

#2

And could you mark the whole code and click on the </> symbol so we can read your code better

#3

@oliver_houghton_rhs: I edited this post, noticed a few things with your code.

1 - You're trying to set three values, where each one of them is a dictionary, to the variable student (right above your get_average() function definition), poor thing, it can't handle like this!
2 - You've created another list called students but you passed as argument to your function get_class_average() as student other than students.

I could only notice those two things.

Best regards,
G4be.

Edit: According to OP and after testing it, the code works and I can't really understand how he managed to store three references to the dictionaries inside of the student variable.

#4

there is no problem I was practicing using the forum to help my g's

#5

worked for me :):):):):):):):):))::)):):):)):):):):):)):

#6

True, there was no problem, my apologies.
I wonder how you stored three dictionaries inside a variable, who's not a list or anything, and it worked.

Interesting.
I'll try to find out the reason for this.

Once again, my apologies.

Best regards,
G4be.