What's wrong with my lists in Python basics challenge to make a list of colors?
So this is how I just learned to make a list in Python basics: my_list = [1,2,3]. Can anyone tell me what I'm doing wrong by applying the same format to this challenge?
colors = [yellow,black,purple,red,orange]
Jason AndersTreehouse Moderator 144,866 Points
You're close. You are just missing the quotation marks around each of the colors. Without the "" Python thinks that each of your colors are variables. That's why you will be getting the "... is undefined" error.
colors = ["yellow", "black", "purple", "red", "orange"]
Keep Coding! :)
Thank you, I thought I was making a variable, but I guess the list is not considered part of the variable, or it is what defines the variable? During the previous video the example given in workspace on how to create a list using Python was done this way: my_list = [1,2,3] etc. and no "" were used, do you know why it would be different, is it because we were using numbers?