Python Python Basics (2015) Python Data Types List Creation

challenge machine bugged?!?

NameError: name 'blue' is not defined on my code

but im pretty sure you cant get much wrong with this simple code i have here
colours_list = [blue, orange, red, violet, indigo]
Jennifer Nordell
Jennifer Nordell
Treehouse Moderator

In addition to Johannes Scribante 's excellent answer, I would point out that the challenge is also looking for the list to be named colors. When doing these challenges and it asks for a specific variable name you must use that variable name, otherwise, the checker will be unable to determine the value of the variable it is looking for. It's also important to note that the spelling must be exactly as they have it. If I erased the _list from your variable name, it would still be incorrect as you are using the British English spelling of colours instead of the American English spelling of colors.

1 Answer

Johannes Scribante
Johannes Scribante
19,174 Points

Hi Mark,

When creating a list you can put anything inside the list. That includes variable, strings, numbers, and other lists.

Python has a way or recognizing each of these types.
variable: this is a variable
"string": this is a string
2: this is a number
[variable, 3, "string"]: this is a list

You have essentially made a list of variables, so when python is asked to include the variable blue it looks through the script for a variable blue and because it cannot find the variable, python throws an error. Try making you list entries strings.