Need help on how is everyone doing?


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

# Add your function below!
def average(numbers):
    total = sum(numbers)
    total = float(total)
    total = total / len(numbers)
    return total

def get_average(student):
    homework = average(student["homework"])
    quizzes = average(student["quizzes"])
    tests = average(student["tests"])
    return 0.1 * homework + 0.3 * quizzes + 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"
    print get_average(llyod)

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


its giving me this error :
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


#2

Well first off, and it might not be your main problem, but I believe you should have students instead of student.


#3

Three additional issues regarding this statement ...

student = ["llyod", "alice", "tyler"]

... are ...

  • llyod should be lloyd.
  • Remove the quotes; the items should be variables.
  • This assignment statement should be global rather than to be enclosed within a function definition.

#4

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

def get_average(student):
homework = average(student["homework"])
quizzes = average(student["quizzes"])
tests = average(student["tests"])
return 0.1 * homework + 0.3 * quizzes + 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"
print get_average(llyod)
students = ["lloyd", "alice", "tyler"]
def get_class_average (students):
results = []
for student in students:
x = get_average(student)
results.append(x)
return average(results)
print get_class_average(lloyd)
print get_letter_grade(students)

okay so I changed the things highlighted but still same error and and I'm not sure if that students list has to go somewhere specific but I put out of the function but would it maybe have to go above all the fuctions

#5

sorry I replied to the topic not you I don't if it notifies you that I replied


#6

sorry I replied to the topic I'm not sure it notifies you


#7

The quotes are still there; they need to be removed ...

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

Check all your other statements for the spelling of lloyd.

We will see it if you reply.


#8

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