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 trialMark Odell
1,442 PointsWhat are ways to remove an element in a list at a certain index?
What are ways to remove an element in a list at a certain index? Possible examples:
list.remove(index=1)
list.removeAtIndex(1)
1 Answer
james south
Front End Web Development Techdegree Graduate 33,271 Pointsyou can use slice notation, eg if myList[3] is t, putting myList[3] as the argument to remove called on myList would remove the t.
myList = [1,2,3,'t',55]
myList.remove(myList[3])
print(myList)
[1,2,3,55]