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

Akki Paunila
Akki Paunila
1,675 Points

Teach me please

I have tried several things here, none work.

If I were to make this colors list like Kenneth did in the video, it would be like this;

[blue, black, green, white, red] colors_list = [blue, black, green, white, red]

And if I would name the colors first, I would do it like this;

color = "blue", "black", "green", "white", "red"

Now, I'm getting pretty tired of the error messages the name blue or the colors are...

So please, can you be kind enough to teach me how to make this colors list and explain why it goes like that? Because obviously I am doing something wrong and I do not know what it is.

I even tried to name the color black like this; color = "black", and it still gave an error. Even if I'm 100% sure you name things like that. Am I not right?

Thank for the help!

lists.py
[black, white, blue, green, red]
Josue Bohorquez
Josue Bohorquez
426 Points

It's quite simple, remember that colors aren't defined so you must create strings(adding text). Like this: color_list = ["blue", "black", "green", "white", "red"]

2 Answers

Josue Bohorquez
Josue Bohorquez
426 Points

It's quite simple, remember that colors aren't defined so you must create strings(adding text). Like this: color_list = ["blue", "black", "green", "white", "red"]

Akki Paunila
Akki Paunila
1,675 Points

This is the first that I tried, did not work. I'm really confused here.

Akki Paunila
Akki Paunila
1,675 Points

Thanks mate, got it eventually like this;

colors = ["black", "green", "white", "blue", "red"]

Got confused with the list thing though, I thought that you are supposed to make a list with _list, like colors_list.

Oh well, let's keep the momentum going. =)