Part of the whole - Just wondering


Hi people!

First, I finished this exercise with only minor complication. As much as I checked the forum, this was quite common. I put the list students = [lloyd, alice, tyler] in the function get_class_average (like so

def get_class_average(students):
results = []
students = [lloyd, alice, tyler]
for student in students:
return average(results)

I tried a few things, like deleting that list, and it worked. But then I wondered, how come the function get_class_average know who these students are if we didn't define the list students anywhere?

Much thanks to all who take time for this question :slight_smile:


well you define the students list in 3. put it together. But it seems that in one of the lessons, the list gets lost.

In the next exercise you will add a function call. When adding a function call, you will supply an argument to satisfy the function parameter students

You don't have to satisfy function parameters until you call the function. parameters are "only" placeholders


ah I see, thank you very much :slight_smile:

(so i did a quick test to confirm i understand what you ment :stuck_out_tongue:
salami = [lloyd, alice, tyler]

def get_class_average(cereal):
results = []
for student in cereal:
return average(results)

print get_class_average(salami)
print get_letter_grade(get_class_average(salami))


well, based on that code it seems you understood it perfectly :smiley:


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