Lesson Number One


#1



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


Oops, try again. Did you create a dictionary named lloyd? Your code threw a "global name 'lloyd' is not defined" error.
Traceback (most recent call last):
File "python", line 2, in
NameError: name 'name' is not defined

Instructions
Create three dictionaries: lloyd, alice, and tyler.
Give each dictionary the keys "name", "homework", "quizzes", and "tests".
Have the "name" key be the name of the student (that is, lloyd's name should be "Lloyd") and the other keys should be an empty list. (We'll fill in these lists soon!)


lloyd = {
    name: [],
    homework: [],
    quizzes: [],
    tests: [],
}

alice = {
    name: [],
    homework: [],
    quizzes: [],
    tests: [],
}

tyler = {
    name: [],
    homework: [],
    quizzes: [],
    tests: [],
}

print lloyd["name"]


#2

why are your dictionary keys variables? I would make them strings


#3

Even when I do that I get errors. Lemme show you


#4

lloyd = {
name: "Lloyd",
homework: [],
quizzes: [],
tests: [],
}

These are the errors I get:

Traceback (most recent call last):
File "python", line 2, in
NameError: name 'name' is not defined

Oops, try again. Did you create a dictionary named lloyd? Your code threw a "global name 'lloyd' is not defined" error.


#5

Oh I see what you are saying! Lemme try to change... name to "name"


#6

I got the solution!

lloyd = {
"name": "Lloyd",
"homework": [],
"quizzes": [],
"tests": [],
}

alice = {
"name": "Alice",
"homework": [],
"quizzes": [],
"tests": [],
}

tyler = {
"name": "Tyler",
"homework": [],
"quizzes": [],
"tests": [],
}

print lloyd["name"]

Just misread the solutions. Thanks!


#7

good you figure it out :slight_smile:


#8