Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Collections (2016, retired 2019) Lists Creating lists

I don't know how to add a list inside a list.

I tried many different ways of doing this until I came across this one which is clearly wrong. Could you please explain to me how and why? Thanks

lists.py
my_list = ['3', '2', '1' 'hi', 'bye']
mys = ['reel', 'cake']

my_list = my_list.append(mys)

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 67,989 Points

Very close. The challenge is looking for three numbers not a string with a numeral character. Remove the quote from around the numbers.

Edit: also, assignment to my_list is not necessary. append() alters a list in place:

? my_list.append(mys)