Python Python Basics (2015) Python Data Types List Creation

Making a list of 'colors' append ([red])

I want to create a new variable called 'colors' and add it to a list of 5 other things. so far I'm lost.

lists.py

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 56,389 Points

1 Make a new variable named colors.

A new variable is made by assigning something to a newly name object:

colors = something

2 Assign it to a list of at least 5 items.

A list is denoted by square brackets []. Items inside are separated by commas

colors = []

3 They should be colors but I won't mark you off for that.

The names of colors are strings. String need to be enclosed in matching quotation marks.

colors = ['red', "blue", "green", "puce", 'ecru']