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

Logan Valdez
PLUS
Logan Valdez
Courses Plus Student 6,741 Points

What did I do wrong?

Hello. In this challenge I am supposed to add two more members to my_list, but none of the methods I have tried are working. What do I do to fix my code?

lists.py
my_list = [1,2,3,"Red","Blue"]
my_list.extend("ab")

1 Answer

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hi Logan,

I think you maybe misread the instructions. You are to add another list with 2 items in it to the list created with the first line, so there will be a list inside of a list, but right now you are just adding one object (the string "ab").
You're on the right track, but extend() isn't the method you want to use, as the instructions want the actual list added, not the iterables in the list. So, you'll want to use append(). Have a quick look at this post about the difference between the two methods.

So, just modify the second line to use append() and then pass in a list with 2 items as the arguments.

Keep it up! :) :dizzy: