HELP ! Student becomes the teacher : How is everybody doing?


#1



Student Becomes the teacher : How is Everybody Doing

I am getting this error message even after trying multiple solutions after mine was unsuccesful.


Replace this line with your code.


#2

this is my code


#3

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

students = [lloyd, alice, tyler]
print get_class_average(students)
print get_letter_grade(get_class_average(students))

  • Instead of x, you want to write student. This is how I did it and it worked. Replace x with student in the for loop and the append. I think the reason why you need to use student is because it was the argument used for get_average.

  • Instead of writing 'results.append(get_average(x))', I just wrote students but yours works fine as well. Just replace x with student and it will work.

  • For the last part of the code, I made a list called students but your code works.

Overall, you just need to replace x with student and your code will work.

Hope this helps you!


#4

i tried whhat you sent and its still giving me the same error . saying something is broken .


#5

can you send a screenshot or copy and paste your improved code


#6

I have realised that you have made two other errors that I didn't notice before.

You have an indentation error after the for loop.

Before 'results.append(get_average(student))' or line 56, you need to add 'result = get_average(student)'. This was an instruction from the previous exersize.

All you have to do is fix the indentation and you have to add 'result = get_average(student)' between line 55 and 56.

Have a go and see if it works


#7


#8

Just create your list "students" outside of any functions (you don't need any indentation)
You don't need indentations for last two "prints" as well.
Cheers!


#9

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