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

Miranda Shipley Gonzales
Miranda Shipley Gonzales
222 Points

list practice

colors = [blue, yellow, orange, gold, purple] colors = [red, white, blue, gold, yellow]

Both times when answering the challenge question, I received the answer that the first item in my list was not defined. From the lesson I just viewed, this seems an accurate list. What am I missing? Thank you!

lists.py
colors = [blue, yellow, white, gold, orange]

2 Answers

Hello there,

The reason you are getting item is not defined is because you are passing in the colors as if they were variables. The challenge is asking you to create a list of colors. You need to surround the colors in the list with single or double quotes because you are passing in strings of colors.

If I were to create a list of colors that I like, I would do the following:

my_list = ['Black', 'White', 'Grey', 'Orange']

You can also use double quotes:

my_list = ["Black", "White", "Grey", "Orange"]

Now, for your list to work without quotes, you would have to define each color before using it. As in my example, I would have to define Black, White, Grey and Orange as variables before I can use them in the list without quotes..

I hope that helps and keep it up, you are doing great. Never give up. :)

Antonio De Rose
Antonio De Rose
20,885 Points

you are missing the quotes inside the list.

colors = ['blue', 'yellow', 'white', 'gold', 'orange']