How is everyone doing error


#1

Student becomes the teacher lesson 9 of 9 how is everyone doing
I have gone back thure all the lessons and I don’t see were there is a problem but I keep getting the error code “One of the following is missing or broken when we tried to use it: alice, lloyd, tyler, students, get_class_average, get_letter_grade
Run”

This is what I got so far

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]
}

student = [lloyd,alice,tyler]
def average(numbers):
  total = sum(numbers)
  total = float(total)
  total /= len(numbers)
  return total
def get_average(student):
  homework = average(student['homework'])
  quizzes = average(student['quizzes'])

  tests = average(student['tests'])
  return (homework * .10) + (quizzes * .30) +  (tests * .60)

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

#2

Hi @salbri29,

In order to help you, we’re going to need a few things:

  • A link to the lesson
  • Your formatted code
  • Any and all error messages you have received

#3

the list:

student = [lloyd,alice,tyler]

is named wrongly, it should be students (plural)

for @aquaphoenix17 the exercise url:

https://www.codecademy.com/courses/learn-python/lessons/student-becomes-the-teacher/exercises/how-is-everybody-doing-?action=lesson_resume


#4

Then why did it pass all the other lesson when I have not touched that code since the lesso it had me write in


#5

i don’t know. Did this fix the issue?


#6

The submission correctness test (SCT) explicitly looks for the students variable only in exercises 3 and 9. With the other exercises, the user can pass without having that variable.

After this statement is added in exercise 3, the user should make sure that it does not get lost or changed later on …

students = [lloyd, alice, tyler]

EDIT:
The problem with retaining that line relates to a bug that has existed for a long time For details, see:


#7

I thought that I had change the student list to students and changed the print statments to mach before. but now it is working.


#8

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