Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python

lists

I have been asked to create a new list by assigning 5 items to the variable colors. What I typed was: Colors= [red, blue, green, purple, orange]

What I get is an error: name 'red' is not defined

4 Answers

Anish Walawalkar
Anish Walawalkar
8,534 Points

you forgot the quotes:

colors = ['red', 'blue', 'green', 'purple', 'orange']

Let's practice making a list. Make a new variable named colors. Assign it to a list of at least 5 items. They should be colors but I won't mark you off for that.

This is the challenge

Let's practice making a list. Make a new variable named colors. Assign it to a list of at least 5 items. They should be colors but I won't mark you off for that.

This is the challenge

Anish Walawalkar
Anish Walawalkar
8,534 Points

Amel, I just did the challenge. look at my answer, you just forgot to put quotes around your color names. :)

Thank you so much Anish!!!

Haider Ali
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Haider Ali
Python Development Techdegree Graduate 24,724 Points

Hi, I spotted two things wrong with your code. Your colors variable starts with a capital letter and your colors are also not strings:

colors = ['red', 'blue', 'green', 'purple', 'orange']