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 Python Basics (2015) Python Data Types List Creation

jamie Macdiarmid
jamie Macdiarmid
2,048 Points

Can someone remind show me?

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.

lists.py
my_list= [red, yellow, green, blue, orange]

4 Answers

Grigorij Schleifer
Grigorij Schleifer
10,364 Points

Hi jamie,

try this:

colors = ["Red", "Yellow", "Blue", "Green", "Purple"]

Grigorij

jamie Macdiarmid
jamie Macdiarmid
2,048 Points

Hi. Thanks Grigorij. Forgot to put each color in "". Is that because I have to define each color?

Grigorij Schleifer
Grigorij Schleifer
10,364 Points

Hey,

you need " " for every word, so it can be recognised as a string. And the colors will represented as Strings here, so you are right

jamie Macdiarmid
jamie Macdiarmid
2,048 Points

Thanks again. sometimes you feel like eating your own neck!!

Grigorij Schleifer
Grigorij Schleifer
10,364 Points

I think this is something you need to hammer all this crazy programming stuff into your brain :)

Keep on hammering Pythonista !

The video does not show needing the " for each word.

Matthew Goldenberg
Matthew Goldenberg
3,096 Points

This is over a year late, but hopefully helpful to somebody. I believe (and could be mistaken) that "" is only necessary for anything that is NOT an integer. The lists in the video were all integers [1, 2, 3, 4, 5].

Can somebody confirm or reject this?