Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Basics (2015) Python Data Types List cleanup

Scott Larson
Scott Larson
2,813 Points

lists del(messy[2]) code won't pass, why?

I've run this code in a python terminal and it works properly. Is something broken in the backend?

lists.py
messy = [5, 2, 8, 1, 3]
del(messy[2])
Scott Larson
Scott Larson
2,813 Points

I figured it out. In the simulated python terminal in the challenge you don't use the parens. In the python terminal you can use paren or not, I was using them. I removed them and this worked straight away.

so del messy[2] works.

1 Answer

For some reason, the challenge doesn't like you using the parentheses around messy[2]. I'm 100% sure your code is fine, I think it's just the code challenge is extremely extremely picky. :expressionless:

del messy[2]

I hope this helps :grin:

Happy coding! :tada:

:dizzy: ~Alex :dizzy:

Scott Larson
Scott Larson
2,813 Points

Hi Alex, Thank you for the feedback.

Best Regards, -Scott