Part of the Whole and Error: Make sure you define get_class_average


#1

See my code and please help

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

#2

@darfw: Looking at our codes, they're both equal, considering you'll indent your code.
Have you tried refreshing the page or something?

If none of this works, let us know!


#3

Hi g4, thanks for the reply!

I tried refreshing the page, restarting the browser, same issue.

I indented, yes, just not sure how to get it done in this message.

What to do?


#4

Okay, so let's recap the instructions and see if everything is there:

It seems everything is following the instructions that were given and still doesn't work? That's odd.

Have you tried in another browser?


#5

Ahhhh I see my problem...I actually indented at the beginning so
def get_average_class (students) was indented and so the loop did not start over (hope I get that terminology correct) .

I only noticed this when trying in another browser

Thanks a million g4!!


#6

Just so you know for the next time, here's how it's done:


#7

Thanks nico

Let's see if this works:

def get_class_average(students): [**cannot seem to get first this line to be written as code and this others is code only if I leave a blank space]

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

#9

I think the easiest method is with the three backticks ```. Try editing your post with that.


#10

got it thanks nico!

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