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 trialJonathan Kobylasnki
Courses Plus Student 2,343 PointsTask one no longer working?
No sure where i'm going wrong here I have done what the task ask's but now task one is no longer working?
messy_list = ["a", 2, 3, 1, False, [1, 2, 3]]
# Your code goes below here
messy_list.insert(0, messy_list.pop(3))
messy_list.remove('a')
del messy_list[4]]
del messy_list[-1]
1 Answer
Stephan Livera
4,146 PointsHi Jonathan,
I think what's happening here is the 'order of operations' is changing the list positions so you have to 'account for this' in your code. i.e. once you've "popped" the 1 back to index position 0, and removed "a" from the list, "False" is now in index position 3. Then once we delete "False" at index position 3, then the list [1, 2, 3] is NOW in index position 3 so we simply repeat the command to get rid of it.
Code below should work:
# Your code goes below here
messy_list.insert(0, messy_list.pop(3))
messy_list.remove('a')
del messy_list[3]
del messy_list[3]
Stephan