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 Basics (2015) Python Data Types List cleanup

del messy [2] not working?

The task is to delete the 8 from the list

When I copy and paste the code into IDLE or the python shell, it works just fine, and the '8' is deleted as the task requires. But the quiz refuses to accept the answer! What am I missing here? Thanks for any pointers

lists.py
messy = [5, 2, 8, 1, 3]
del messy [2]

1 Answer

You have a space between messy and [2].

messy = [5, 2, 8, 1, 3]
del messy[2]

Thanks, that was ridiculously easy after you pointed that out. Spent 15 minutes driving myself crazy with it. Cheers!

You're welcome. Hard to catch the small mistakes sometimes. Especially when it's a space rather than a typo that's easier to see. Happy coding!