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

Marcus Farrugia
Marcus Farrugia
613 Points

Remove 2 from list

The task is asking to delete 2 from the list: mess = [5,2,8,1,3] using del del messy[1] #should work, task 2 on deleting indexes

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

1 Answer

Jennifer Nordell
Jennifer Nordell
Treehouse Teacher

Hi there! You're doing great, and you've understood how to do this. But the problem is that you've removed the previous code that's removing the 8. Take a look at this informational tip from Treehouse:

Important: In each task of this code challenge, the code you write should be added to the code from the previous task.

When you move to the next step, it's important that you don't remove the code from the previous step unless explicitly asked to do so. Even if your code would be functional, it can cause the challenge to fail.

:bulb: Hint: you will need two separate del statements. One for the 8 and one for the 2.

Hope this helps! :sparkles.

Marcus Farrugia
Marcus Farrugia
613 Points

Thanks Jennifer, that worked for me!