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! While you're at it, check out some resources Treehouse students have shared here.

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

Python Python Basics (2015) Python Data Types List Creation

Daniel Amini
Daniel Amini
200 Points

Making a list of colors

I just watched the lesson on making lists. The example in the lesson was a list of numbers which apparently is easier than a list of colors.

The challenge is the list of colors... I am receiving a name error.

I also attempted jut the first part of variable = "colors" and I was prompted with the error of "colors not defined"

Is there anywhere on this site where I can find an answer sheet so I don't have to use this question feature every time?

lists.py
varialble = "colors"

colors = [red, blue, black, green, brown]

1 Answer

bryonlarrance
bryonlarrance
16,414 Points

In python there isn't a need to declare a variable. For instance, just label the list and that label becomes the variable.

colors = []

Also, words inside of a list are strings and need quotation marks around them (single or double are cool)