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

Nathan Sanders
Nathan Sanders
661 Points

del(messy[2]) is removing 8, but the check still fails.

Trying to pass the final task in the list section and using the del() function. However, the treehouse check is still failing. I checked the variable and it is in fact removing 8 from messy.

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

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! You're close here, but you have an extraneous pair of parentheses. When I delete those, your code passes. You can find some more examples on how the del statement is used in this Python documentation in section 5.2.

Also, to be clear, del is not a function, but rather a statement much like a return statement.

Hope this helps! :sparkles: