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.remove()

Arun Patel
Arun Patel
1,180 Points

Is below syntax correct where states is a list states.remove(["red", "green", "blue"]

Is the syntax incorrect to remove list from list?

states = [
    ['red', 'green', 'blue'],
states.remove(["red", "green", "blue"])

2 Answers

Jason Anders
Jason Anders
Treehouse Moderator 145,858 Points

Hi Arun,

Yes, that code is correct. However, you seem to be missing the line of code from Task 1?

Challenges are picky and instructions must be followed exactly. Also, as each task progresses to the next one, you add the code to the code you have from the last task (unless specifically instructed otherwise).

Just add the first line of code back in (above the code for task 2) and it's all good. :thumbsup:

Keep Coding! :) :dizzy:

Arun Patel
Arun Patel
1,180 Points

Thanks for the confirmation. When I moved to the next task, on the task windows automatically the previous task was removed. This caused the confusion since I thought only task2 needs to be solved. it would have been better it this is mentioned as instruction for task2. I have cleared task2 now.