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 trialIvana Bojcic
Python Development Techdegree Student 892 PointsStruggling with Beatles
"Okay now let's add all of the items in others list to the beatles list. Can you please use the method on lists that allows you to add all values from one list to another?"
beatles = ["John"]
others = ["George", "Ringo"]
last_one = ["Paul"]
beatles.append(others)
beatles.extend(last_one)
beatles.extend(others)
What's wrong?
2 Answers
Steven Parker
231,198 PointsIt looks like you added the others twice, and using two different methods.
Be sure to add it on only one time, using the correct method.
Ivana Bojcic
Python Development Techdegree Student 892 PointsWhen I remove it, I get this error.
======================================================================
FAIL: test_others_added (__main__.TestAppendExecution)
----------------------------------------------------------------------
Traceback (most recent call last):
File "", line 21, in test_others_added
AssertionError: 'Ringo' not found in ['John', ['George', 'Ringo'], 'Paul'] : Make sure you extend the list with the others
----------------------------------------------------------------------
Ran 1 test in 0.000s
FAILED (failures=1)
ยดยดยด
Steven Parker
231,198 PointsSteven Parker
231,198 PointsNotice that you're putting one entire list inside the other as a single element. That's an indication that the wrong method is being used.
Be sure to "use the method on lists that allows you to add all values from one list to another".