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 trialAndrew Zdunek
432 PointsProblem: Use del to delete the 8 from messy. Problem: messy = [5, 2, 8, 1, 3] My solution: del messy[8] Wont work.?
.
messy = [5, 2, 8, 1, 3]
del [8]
3 Answers
Andrew Zdunek
432 PointsThanks Balaz,
I did this before but workspace didn't register this for me for some reason. Thanks for the demo chart.
Andrew Zdunek
432 PointsIt did work by the way.
Balazs Peak
46,160 PointsI'm glad to help! Have me on facebook! Maybe later on we can work on projects together, or who knows!
facebook.com/puklibalazs
Balazs Peak
46,160 PointsI do not do Python, but this looks like a form of array, or list object for me. The included items are probably reached by an index number, not the value themselves. Also note, that indexes usally start from zero, not one. In this case:
messy = [5, 2, 8, 1, 3]
5 - the first item, index:0
2- the second item, index: 1
8- the third item: index: 2
... etc
so if you want to delete the 8 from the list, and you are sure that the appropriate command is "del", then you should type this, or at least something like this:
del messy[2]
Much love!