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 (2016, retired 2019) Lists Creating lists

Corinn Zieglgansberger
Corinn Zieglgansberger
2,419 Points

Code challenge 1-Python Collections

Create a single new list variable named my_list. Put 3 numbers and 2 strings into it in whatever order you want. For the last member, though, add another list with 2 items in it.

I don't understand what the question is asking here. When I made just the my_list list it said that I need to have six objects in the list. When I tried to append two more items to the list I got an error and when I made a separate list I also got an error. Just wondering what it's asking!

lists.py
my_list = [1, 2, 3, "string 1", "string 2"]

1 Answer

Jeff Muday
MOD
Jeff Muday
Treehouse Moderator 28,720 Points

The question is looking for you to embed a 2 element list as the last item.

The point is to demonstrate that lists can contain any sort of object regardless of type. Lists of lists, lists of integers, lists of dictionaries, singleton objects... endless possibilities.

my_list = [1, 2, 3, "string 1", "string 2", ["what is the answer?", 42]]
Corinn Zieglgansberger
Corinn Zieglgansberger
2,419 Points

Oh! Thank you so much. That makes so much sense. A really appreciate your help.