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 144,840 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: