Python Python Basics (2015) Python Data Types List Creation

Akki Paunila
Akki Paunila
1,674 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,674 Points

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

Akki Paunila
Akki Paunila
1,674 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. =)