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

Warren Chisasa
Warren Chisasa
3,731 Points

General code problem

I am submitting code for this task but I am referred back to the previous task. I am not sure if the problem is with my code or the platform. I have tried different lines of code but I keep getting the same error message which refers me back to the previous task. Asking for help!

lists.py
the_list = ["a", 2, 3, 1, False, [1, 2, 3]]
the_list.pop(0)
the_list.insert(0, the_list.pop(2))
the_list.remove(False)
del the_list [-1]

# Your code goes below here

1 Answer

Nathan Tallack
Nathan Tallack
22,160 Points

Righto, by the last step your list contains just the integers 1, 2, 3 and nothing else. So you want to extend the list so it contains the numbers 1 through to 20. So you would use something like this.

the_list.extend(range(4, 21))

Remember, range is not inclusive of the last, so 4 through to 21 extends the list with the list that is made from that range command consisting of the integers 4 through to 20.

Keep up the great work! :)

Warren Chisasa
Warren Chisasa
3,731 Points

Thanks big time. I guess I was vague last time when I submitted the code. I tried extending my list but it didn't still work. I have reposted the question with all the details.

gracias!:))))