Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
It keeps saying I cant just add another list but move it. What am i doing wrong?
What am I forgetting to do?
the_list = ["a", 2, 3, 1, False, [1, 2, 3]] # Your code goes below here the_list.pop(0) the_list.insert(0,1)
Welcome to Treehouse!
I don't have a ton of experience with Python, but I think I can help you with this. Let's walk through your code...
the_list = ["a", 2, 3, 1, False, [1, 2, 3]] the_list.pop(0) # This is removing the "a" at index 0. You want to remove the 1 at index 3. the_list.insert(0,1) # This is inserting a new 1 at index 0. # You can do this in one step by using the pop method inside insert. the_list.insert(0, the_list.pop(3)); # Pop the value at index 3 and insert it at index 0.
Remember that the index values of a list start at 0. This will be important in the rest of the challenge.
Please let me know if anything is unclear, or if you get stuck on the other challenge steps. Happy coding! :)
Seth Reece32,867 Points
The challenge is asking you to move the "1". It is at index 3, not 0.
the_list.pop(3) the_list.insert(0, 1)
passes for me.