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

List I have tried this Question but it doesn't work

my_list=[ "1", "6", "4", "Apple", "Orange", "James" ] member=["We", "Gat"]

lists.py
my_list=[
    "1",
    "6",
    "4",
    "Apple",
    "Orange",
    "James"
]
member=["We", "Gat"]

7 Answers

With what you have try:

my_list=[
    1,
    6,
    4,
    "Apple",
    "Orange",
    ["We", "Gat"]
]

Some things:

  • numbers shouldn't be enclosed in quotes
  • you only want two strings. you have added three
  • the last list item in my_list should be another list

I believe its asking for a list inside a list like this.

my_list = ["mouse", [8, 4, 6], ['a']]

It doesn't work yet

This is the actual question: 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.

Thanks

my_list = [12,13,14,"apple","pear" [15,"orange"]]

This is the correct answer.