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

David Payne
David Payne
1,298 Points

.insert problem

.insert problem adding "start" to he front of my list?

lists.py
best = ['best', 'better', 'great']
best +=('rain', 'drops')
best.insert=[0, "start"

1 Answer

you're close. insert is a method, which is basically a function that belongs to an object. think of it as calling a function named insert on the list named best. you call a function as: function_name(args)

so insert is: insert(position, value)

best = ['best', 'better', 'great']
best +=('rain', 'drops')
best.insert(0, 'start')