Creating students list error, and no I didn't put strings in the list


#1



https://www.codecademy.com/en/courses/python-beginner-en-qzsCL/0/3?curriculum_id=4f89dab3d788890003000096


Oops, try again. Did you create a list called students? Your code threw a "global name 'students' is not defined" error.


I expected it to create a list called 'students' just as instructed. I've read through all the other posts and everyone else had errors because they put lloyd, alice, and tyler in as strings with quotes around them. I can't seem to find my error.


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]
  
students = [lloyd, alice, tyler]


#2

Hi @jordanpearcey,

Delimit the end of tyler's dictionary with a } character, as you did with lloyd and alice's. Without it, the beginning of the next line raises a SyntaxError.


#3

mine got the } but still it is not working pal, the result is none but i get this error

Oops, try again. It looks like Lloyd is not in the students list.


#4

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

students = [lloyd, alice, tyler]

use this code verbatim, look at the differences. Even if you do not find a difference, just use this code, and hopefully it will work.


#5

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