Lesson Number One



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

It looks fine to me but I think there is probably a small error I can't detect

 lloyd = {"name" : "Lloyd", "homework" : [],"quizzes" :[],"tests" : []}
 alice = {"name" : "Alice", "homework" : [],"quizzes" :[],"tests" : []}
 tyler = {"name" : "Tyler","homework" : [],"quizzes" : [],"tests" : []}

I did create a dictionary called Lloyd!


can you post your code with markup:

make sure the backticks are above and below the code, not on the same line


the lloyd dictionary should be all lowercase letters?


That was an accident in this post sorry so it didn't fix my original code



there are two curly brackets, why?


Also another error only in this post :frowning:


How can you make errors in this post? You simply copy paste the code from the lesson. If you don't, i won't be able to find the mistake


My apologies. Here is a full on copy paste. (which i what i thought i had in the first place)

lloyd = {                                                                               "name" : "Lloyd",                                                                  "homework" : [],                                                                   "quizzes" : [],                                                                     "tests" : []                                                                  }
 alice = {                                                                               "name" : "Alice",                                                                  "homework" : [],                                                                   "quizzes" :[],                                                                     "tests" : []                                                                  }
 tyler = {                                                                               "name" : "Tyler",                                                                  "homework" : [],                                                                   "quizzes" : [],                                                                     "tests" : []                                                                  }

I used tab make big spaces in between to make it look like it does in the description


ugh it didnt print out right but im positive the code at the top is the same as mine now except for the spaces


why would you use so much tabs? It doesn't make much sense, it ruins the readability of your code.

you could simply use enters:

lloyd = {
   "name": "Lloyd"

that would make more sense.


when i use enters it creates a new line, how do you prevent that?


Doesnt the creation of the new line ruin the code?


that is kind of the point of enters?

not when used correctly, a dictionary can be created over multiply lines


Oh for some reason i thought otherwise. Anyways if it would help you, in the interpreter it says "Indentation error:unexpected indent"


can i see your code again?


lloyd = {                                                                               "name" : "Lloyd",
      "homework" : [],
      "quizzes" : [],
      "tests" : []
 alice = {
     "name" : "Alice",
     "homework" : [],
     "quizzes" :[],
     "tests" : []
 tyler = {
     "name" : "Tyler",
     "homework" : [],
     "quizzes" : [],
     "tests" : []


 alice = {

alice (and tyler) seem to have one space as indent, why?


I don't exactly know what you mean :confused: could you post one of the dictionaries in the way you would do it so I can understand better? sorry for the trouble.


At this point in the course, i have to assume you know what indent(ion) is, python uses it to determine what inside function, loop and so on. How can you make it this far, and not know this?

one space also counts as indent, remove the space which is in front of alice = {


more properly a clear indent is 4 spaces, if I don't do tab or 4 spaces it has an error about "invalid syntax: expected an indention"