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 Collections (Retired) Lists Redux Combining Lists

Need help for list_2.

Need help for list_2, I don't understand this question.

lists.py
list_1 = list(range(3))

list_2=list[4, "ed", False]

2 Answers

list() is a function. When you call list[] you should be receiving a syntax error. Lists in python are any selection of objects enclosed within square brackets [].

the list() function takes an argument (the variable you write inside the parentheses). The argument needs to contain an iterable, which is any python objects that has one or more other objects as its components.

You should try testing the following code to see which ones give you the desired result and which ones give you syntax errors.

a = list(1, 2, "s")
b = list([1, 2, "s"])
c = [1, 2, "s"]
a
b
c
Sean T. Unwin
Sean T. Unwin
28,690 Points

Remove the keyword list so it looks like, list_2 = [4, "ed", False]