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

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