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 trialIgor Dias
5,155 PointsProblem adding an iten in the end of the list using insert
names = ["john","bill","gabriel"] numbers.insert(-1, "Ana")
Why this does not work?
3 Answers
Tabatha Trahan
21,422 PointsIt looks like you may just have called the insert method on the wrong variable name. You declared a list of values called name, but you called the insert method on a list with the name of numbers.
Vincient Degala
1,616 Pointsnames = ["john", "bill", "gabriel"] names.insert(-1, "Ana")
try this
Nick Evershed
6,429 PointsYou called the insert function on an undefined variable called number, probably because you indexed and got confused