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

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,728 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']