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

lists and strings

This challenge is just meant as a refresher. 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. my_list = [ [2, 3, 5], "string1", "string2"]]

lists.py
my_list = [
    [2, 3, 5],
    ('string1'), ('string2')
]
my_list + ['first_item', 'second_item']

1 Answer

Steven Parker
Steven Parker
231,275 Points

Here are a few hints:

  • in the definition of "my_list", the numbers don't need a separate set of brackets around them
  • the strings don't need to have parentheses around each of them (but it doesn't cause an error)
  • the "+" operator won't add the final list, try using the "append" function