Student Becomes the Teacher


#1



On the 'Put it Together' step, we're asked to create a list with the student names.

Creating the following list, I get the error below:
students = ['Lloyd', 'Alice', 'Tyler']
'Oops, try again. It looks like Lloyd is not in the students list.'

Googling around, I found the following which DOES work:
students = [lloyd, alice, tyler]

Previous lessons show lists created with strings requiring either single or double quotes. Why is this case different?


#2

"Below your code, create a list called students that contains lloyd, alice, and tyler."

Well the instructions are your best hint. Usually, if it gives you an exact way of typing something out its best to follow that. However, I can understand your confusion so let me try and explain. First off, you did create a list but it is equaled to an array. That is a key difference. Arrays don't use strings. Secondly, it asks you in an indirect manner for them to be lower cased not capitalized. Yes, maybe deceiving but that is what it asked for. Otherwise it will not be recognized either by an error with the global name or it won't print or it will not recognize the name imputed.


#3

Thanks for your reply.

Capitalization isn't the issue--I'd actually originally typed my list using lower case and got the same error.

Googling I found a response which indicated the non-quoted version is a list of dictionary names, which is ultimately what it was looking for, but I'm not sure how one would have known that aside from trial and error. (I actually went back to the original lesson and lists with words were created using quotes as I'd described initially; there weren't any examples where strings weren't quoted).


#4

Yeah and I completely agree with that statement. Actually even if you unquote and use capitalization its still gonna bring up an error. The reason your lower case didn't work is because I assume you still kept it in quotes. Well, I don't think you need trial and error because it tells you first off what you are building in short in lesson 1: a dictionary: "Step 1 Create three dictionaries: lloyd, alice, and tyler.
Step 2 Give each dictionary the keys "name", "homework", "quizzes", and "tests"." And considering there was only two lessons previous I am not sure what examples you were hoping for? If you mean the previous chapter then I believe access by index is an example without quotes using an array to make a list that you can draw information out of here: https://www.codecademy.com/en/courses/python-beginner-en-pwmb1/0/2?curriculum_id=4f89dab3d788890003000096


#5

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