Python Python Basics (2015) Python Data Types List Creation

keith kearse
keith kearse
274 Points

How to change the name of list variable?

In the previous video it showed that you make a list as such: "My_list=[1,2,3,4]". Is there another way to type the Variable to make it say Colors?

lists.py
list_colors=[red,green,purple,blue,pink]

1 Answer

Ben Reynolds
Ben Reynolds
35,168 Points

Yes, you've got the right idea just make sure if you're storing a collection of string values to put each one in quotes.

keith kearse
keith kearse
274 Points

thank you, i also realized that i don't need to add "List" to make it into a list, The brackets are what identify it as a list.

Facepalming myself