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

James Brazil
James Brazil
390 Points

... how what is wrong with my answer

delete the #8 from messy

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

the quiz says I'm wrong, so I do it in workspace console and I get this

del messy [2]
 print(messy)
[5,2,1,3]

uhh that doesn't have the 8 in there

2 Answers

Stuart Wright
Stuart Wright
41,120 Points

You need to remove the space between the variable name and the square brackets:

del messy[2]
James Brazil
James Brazil
390 Points

you.are.kidding.me lol I cant believe it! how come in the workspace console there is no problem with the added space? is it a formatting thing that we are not supposed to do, but technically its ok?

Stuart Wright
Stuart Wright
41,120 Points

I actually didn't realize that it works correctly even with the space, but you're right - it does indeed seem to work. I've never seen it written that way though, much more common to go without a space.