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 Introducing Lists Meet Lists All You Need Is Lists

3,516 Points

beatles [list]

why is this is wrong?


it seems to be working in the console, all names do move to the Beatles [list], but when this method is used to answer the question the program is expecting ".extend" and it was flagged as wrong.

are both method ok to use in a real-world scenario or besides that it works this would be considered bad practice or something like that?

many thanks.

beatles = ["John"]
others = ["George", "Ringo"]

3 Answers

Eric M
Eric M
11,545 Points

Hi Arielp,

This is not an academic distinction purely for practicing extend, are you sure your console is showing exactly what is requested?

list.append() and list.extend() actually do different things when passed another list as arguments.

The code that you've provided will lead the list beatles to contain

['John', 'Paul', ['George', 'Ringo']]

This is not a 4 item list containing strings. This is a 3 item list (try len(beatles)) containing two strings and a list. Index 0 is "John", index 1 is "Paul", index 2 is a list containing 2 items.

Append adds to the end of the list. Extend will add items from one list to another.

Happy coding,


It seems that the interpreter expects something other than .append() to add the array. .append() worked fine for one value. Maybe try .extend() and see what happens.

3,516 Points

thanks Guys!