Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Euenlee Tan2,165 Points
How do I make a list with the variable colours.
How do I do it? I use colors=[Red,Yellow,Blue,Green,Purple] And it said red isn't defined
Nathan Tallack22,159 Points
You need to pop your strings (that's what your color names are) inside of "" quotes so that it is recognised as a string. Without them it thinks you are typing variable names or other such things. Consider my example below:
colors = ["Red", "Yellow", "Blue", "Green", "Purple"]
Also, one other thing. Readability is VERY important in Python. When someone else is reading your code, or even when you are reading it at a later time, you will appreciate the spaces following the comma and surrounding the assignment operator (the = sign). While not strictly required, good habit to develop early. ;)
Chris FreemanTreehouse Moderator 68,404 Points
You are close. You need to put the words in quotes:
colors = ['Red', 'Yellow', 'Blue', 'Green', 'Purple']