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 Collections (Retired) Lists Redux Manipulating Lists

Task 2 doesn't like task 1!

When I am on challenge 1 it says I have completed the task but when I add in the task 2 code it then says task 1 is wrong...but no one told task 1 that!

lists.py
the_list = ["a", 2, 3, 1, False, [1, 2, 3]]

# Your code goes below here

3 Answers

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

Can you show us your code? Generally, task 1 failing after task 2 is submitted means that your code for task 2 either changed the code that passed task 1 or introduced some breaking/wrong code that causes task 1 to no longer be able to run.

Every previous task is run when you submit an answer for the current task.

I thought I attached this sorry! I'm getting myself confused with this, when I run task 1 it runs but when I add the bottom 3 lines it stops accepting it. It's probably me and a syntax error.

the_list = ["a", 2, 3, 1, False, [1, 2, 3]]

# Your code goes below here
the_list.insert(0, the_list.pop(3))

del my_list[0]
my_list.remove("False")
del my_list[3]
Kenneth Love
Kenneth Love
Treehouse Guest Teacher

I'm gonna walk through your code and comment what'll be in the_list at each step. You can check this out yourself by clicking the "Preview" button in the code challenge.

the_list = ["a", 2, 3, 1, False, [1, 2, 3]]

# Your code goes below here
the_list.insert(0, the_list.pop(3))  # [1, "a", 2, 3, False, [1, 2, 3]]

del my_list[0] # ["a", 2, 3, False, [1, 2, 3]]
my_list.remove("False")  # ["a", 2, 3, [1, 2, 3]]
del my_list[3]  # ["a", 2, 3]

So, Task 1 was to move the 1 to the front of the list and Task 2 required you to get rid of the "a", False, and extra list. Do you see why Task 1 is no longer passing?

please do not even dignify this with an answer. I've realise my dopey mistake...blame it on the LONG day!!

Kenneth Love
Kenneth Love
Treehouse Guest Teacher

Ha, too late! :)

Glad you figured it out!

Thank you! Also helps when you get the list name right XD