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

Gang Liu
Gang Liu
519 Points

1/2 code does not work

my coding does not work with the following format.

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

lists.py
messay = [5, 2, 8, 1, 3]
del messay [2]
Jose Aguirre
Jose Aguirre
14,866 Points

Are you getting error, Did you use del?

It is most likely because you've changed the list's name messy to messay. Too, there is a space between messay and [2] which you can omit.

Try

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

Let me know if this helped you out, or otherwise.

2 Answers

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

Hi there! There are a couple of problems here. First, you've changed the name of the list from messy to messay. You should start by reverting back to the name that the challenge specifies, Secondly, there may not be a space between the name of the list and the index of the list.

# This format will work
del myList[0]

# This format will not work
del myList [0] #note the additional space here

Hope this helps! :sparkles:

Gang Liu
Gang Liu
519 Points

ya, you are right for both. Thanks!!