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

I am trying to make a list variable. This is my code colors = [brown, blue, yellow, purple, red]. It gives me name error

It says brown is not defined

lists.py
colors = [brown, blue, yellow, purple, red]

1 Answer

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hi Dustin,

You are on the right track :thumbsup:, but are missing something vital. Right now, the compiler is looking for variables with the names you have in the list. This is because there are no quotation marks around the words. Without quotation marks, the compiler thinks they are variable names and that is why you are getting the "not defined" error.
If you enclose each word in quotation marks, then that makes them Strings.
I'm sure you'll pass it now. :smiley:

Keep Coding! :) :dizzy: