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 Removing items from a list

Ashley Keeling
Ashley Keeling
11,476 Points

I don't know why this code isn't working

it says :

TypeError: 'list' object cannot be interpreted as an integer

lists.py
messy_list = ["a", 2, 3, 1, False, [1, 2, 3]]

# Your code goes below here
letter1=messy_list.pop([1])
messy_list.insert(0,letter1)

1 Answer

Wesley Trayer
Wesley Trayer
13,812 Points

"pop" doesn't need brackets inside the parenthesis.

something.pop(1) # Just parenthesis, no brackets

Hope this helps! :)

Ashley Keeling
Ashley Keeling
11,476 Points

I have changed it and I needed to replace the one with a 3 thanks for the help