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 Combining Lists

Tadeáš Firich
Tadeáš Firich
7,866 Points

Why my code doesn't work? :)

Hello dear team treehouse community I have tried to solve my problem but it does not work and i don't know why .

lists.py
best = ['My','name','is']
best.extend(['Super','Man'])
best.insert(["start"])

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! I received your request for assistance. You're doing great and made it through the first two steps with no problems. The problem lies on the final line. The insert method takes exactly 2 arguments. You've told it what to insert, but not where to insert it. Also, you've told it to insert a list containing one string element. But what we want to insert is simply a string. Take a look:

best.insert(0,"start")

This will insert the string "start" at the 0 index of the best list. Remember, that indexes start counting from 0.

Hope this helps! :sparkles:

Tadeáš Firich
Tadeáš Firich
7,866 Points

Thank you very much Jennifer.