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'm not sure that I understand the challenge the way it is stated. I can't figure out how to do it. Help!

Please help. I can't seem to figure out what the challenge is asking for. Thanks in advance

lists.py
my_list = [3, 2, 1, contact]+["orange", "banana"]

1 Answer

Louise St. Germain
Louise St. Germain
19,410 Points

Hi Angela,

You're almost there - closer than you think. It's also easier than you probably think - it's not asking you to do any sort of operation. You just literally need to give it a single list containing the following:

  • 3 numbers (which you have)
  • 2 strings (which you have, but put them as items in the same list as your 3 numbers)
  • one list which itself contains 2 items

So rearranging what you already have a bit, your answer will look like:

# three numbers, then two strings, then a list-inside-the-list.
# Put 2 things inside that last list
my_list = [3, 2, 1, "orange", "banana", []]

Up above I have an empty list at the tail end of the big list, but go ahead and put two things inside that empty list (e.g., numbers, strings, whatever), and it should be good to go!

I hope this helps! :-)