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

Arthur Walton
seal-mask
.a{fill-rule:evenodd;}techdegree
Arthur Walton
Python Web Development Techdegree Student 3,906 Points

Challenge doesn't make sense

stuck on this challenge? i don't know if it's how the challenge is worded or if just lost. can anyone please help. thank you.

lists.py
my_list = ["I'm pretty tired.",
           "This i getting frusterating",
           5,3,2


]
new_list = [1, 5]

my_list.extend(new_list)

1 Answer

Louise St. Germain
Louise St. Germain
19,424 Points

Hi Arthur,

You're so close! The only thing is that when you use "extend", it merges the list items into the existing list and doesn't retain them as a separate list. So right now, your code will output:

my_list = ["I'm pretty tired.",
           "This i getting frusterating",
           5,3,2, 1, 5]
# Notice that the last 1, 5 are no longer in their own mini list; 
# Python just merged them into one big list.

... where your last 2 items just continue the first list, and are not their own list. The challenge wants this:

my_list = ["I'm pretty tired.",
           "This i getting frusterating",
           5,3,2, [1, 5]]
# Where [1, 5] is a list within a list.

If you use "append" instead of "extend" when you tack [1,5] onto your existing list, everything should work!

Also, you could literally just hard-code the list: if you just put the line I have above, with the list-within-a-list already hard-coded into it, that should also work. The challenge isn't necessarily asking you to go through the trouble of appending a final list. It just wants it to be there, in any way you see fit.

Hope this helps!