Im stuck!


#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=float(sum(numbers))
    
    return float(sum(numbers))/len(numbers)
    
    
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    

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"
        
def get_class_average(students):
    results=[]       
    for student in students:
        results.append(get_average(student))
    students=[lloyd,alice,tyler]
    for students in students:
     print get_class_average(students)    
    


Finally, print out the result of calling get_class_average with your students list. Your students should be [lloyd, alice, tyler].
Then, print the result of get_letter_grade for the class's average.


Im stuck :(
#2

You are a bit confused, you don't need to change your function, you just need to used it as it was in the last exercise and just print results of those calls.


#3

ef get_class_average(students):

results=[]       
for student in students:
    results.append(get_average(student))

return average(results)

print get_letter_grade(get_class_average(results))

the instructions are very bad explained!!!!


#4

Finally:

print get_letter_grade(get_class_average(students))

#5

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_student(students)

print get_letter_grade(get_class_average(students))

IT REMAINS IN AN ERROR


#6

Get rid of the _student and see what happens.


#7

Your return it's not correctly indented.


#8

yeah was my fault there, it doesn´t run anyway


#9

that´s not the problem


#10

Actually if your indententions are off in Python you will not be able to pass your code so do make sure everything is spaced correctly. @gargol12 has a point you can't just ignore. For example, wrong spacing with your return statement can lead to this error: Oops, try again. Did you remember to print the average of the class? It looks like "83.8666666667" wasn't printed. It would help all of us if you shared what specific error you are getting at this moment


#11

yes im noticed about that, even i fixed it, the error still going


#12

Do you mind sharing that with us? Honestly not trying to beat a dead horse but it is hard to fix a problem when you aren't sure what the problem is! :thumbsup:


#13

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


#14

Good! I will copy your code into mine and see what I can do give me a few minutes if you will. If I can't solve this for you I will bring in a mod or super user to help you!


#15

thank you :slight_smile:


#16

Ok well that was easier than expected. Good news! Your code is completely fine and in working order after those changes that me and @gargol12 mentioned. The spacing just needed to be corrected to fit the proper format. The end of your final code should look like this:

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

You have all the pieces there you either A.) need to just respace everything to correct format or B.) make sure you follow the corrections we mentioned above!

P.S. the student list can go above your print statement too just subconsciously put it above the student function


#17

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

nothing happens, call the superior pleaase


#18

did you tried resetting the exercise? or using a different browser?


#19

yeah i tried everything, i´ve been stucked all day in this excersise i have to keep going, call the super user PLEAAAAASEEEEEEEE!!!!


#21

Can we see your full code?