How's everybody doing?


I need help with my code this is my code what am I doing wrong?? :persevere:

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 average(numbers):
total = sum(numbers)
total = float(total)
average = total / len(numbers)
return average
def get_average(student):
homework = average(student["homework"])
quizzes = average(student["quizzes"])
tests = average(student["tests"])
weighted = (homework*.1)+(quizzes*.3)+(tests*.6)
return weighted
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"
return "F"

print get_letter_grade(lloyd)
def average(numbers):

    total = sum(numbers)

    average = float(total) / len(numbers)
    return average

print get_class_average[lloyd, alice, tyler]
print get_letter_grade

Help is greatly apprecieted :blush:


Please post a link to the this exercise, as well as the error messages. Thanks.


I'm confused :confused:


What do you mean?? :disappointed:


Copy the address from the location bar and paste it into a reply. Copy the error message(s) from the the editor and or the console and paste them into the reply.


The Problem Can you help


Traceback (most recent call last):
File "python", line 51, in
NameError: name 'get_class_average' is not defined

That's what it says


You don't have a get_class-average function, but you do have average twice. You'll need to go through your code an make sure all the functions are there.

Declare a students list just under the data dictionaries.

students = [lloyd, alice, tyler]

When you have the function written, be sure to call it like,

print get_class_average(students)


I still don't get what you mean :confused:

9. How is Everybody Doing?
9. How is Everybody Doing?

The functions we should have for this exercise, are,

average              takes a list of numbers
get_average          takes a student dictionary
get_letter_grade     takes a single grade (number)
get_class_average    takes a list of student identifiers

Organize your code and please make an effort to format it when posting into the forums.


Ok I think I get it now thank you


Here's my new code what am I doing wrong??


The data section is,

lloyd = {}
alice = {}
tyler = {}

students = [lloyd, alice, tyler]

The class list (students) (as it is referred to in the lesson) is the list of identifiers that we pass to the last function.


It doesn't work for me is that a soulution??


No. Just a schematic. Suggest go back to the beginning and start over. Make sure each function works as expected before going to the next lesson.


2 posts were split to a new topic: I don't get it


4 posts were split to a new topic: Give me a clue about what is wrong here


2 posts were split to a new topic: What is wrong with this code


A post was merged into an existing topic: What is wrong with this code