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

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.