How is Everybody Doing?


#1



How is everybody doing

whenevr u run this i get this error, and ive looked on the Q&A form and the same solution that helped everyone else is not working for me
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


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

print get_letter_grade(average)


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


#2

Those lines are calling functions that do not exist. May or may not be the problem.


#3

Ya i noticed that right after i posted this, changing them to the correct names still gives me the same answer unfortunately


#4

Try moving the students list to the data area above. Be sure it is written after the dictionaries.


#5

Same thing......I'm thinking it might be a flaw with the actual website


#6

Is your code printing 83.6666... for the class average?

Please post a link to this lesson. Thanks.


#7

https://www.codecademy.com/en/courses/python-beginner-en-qzsCL/1/5?curriculum_id=4f89dab3d788890003000096

and no its not its gicing me the error that "Float is not callable
"


#8

Can we see your revised code, please?

That error message indicates there is a call being made to a float (floats are not functions).


#9

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):
    total1 = sum(numbers)
    total = float(total1)
    return total / len(numbers)
def get_average(student):
    homework = average(student["homework"]) * .1
    quizzes = average(student["quizzes"]) * .3
    tests = average(student["tests"]) * .6
    return homework + quizzes + tests
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'
        
average = get_average(tyler)
students = [lloyd, alice, tyler]
print get_letter_grade(average)

def get_class_average(students):
    results=[]
    for indi in students:
        results.append(get_average(indi))
    return average(results)

print get_class_average(students) 
print get_letter_grade(get_class_average(students))

#10

This variable should not have the same name as the function.


#11

okay i changed it accordingly for that function in the code to average1, unfortunately its still giving me that error


#12

Just trying to elliminate anything that looks off. Will keep looking...

Meanwhile, did you try a page refresh to make sure memory is cleared of old values and code?

This is the fix that solved the problem...

avg = get_average(tyler)
print get_letter_grade(avg)

#13

thanks for all the help i really appreciate it, that did print out C but it is still throwing that error in my face whenever i run it


#14

I went and erased all the code. Will try to remember what all I edited...

That line was moved up to just under the dictionaries. I like to keep all data in one place.

Changed total1 to total to match the instructions.

Changed indi to student since it makes more sense (to me).

And the above mentioned, rename average variable to avg so it does not conflict with the defined function.


#15

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