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.
List Range in Python: Static or Dynamic Value?
When Kenneth introduces the topic of Combining lists, he gives an example of:
However, he then adds the ints: 10, 11, and 12 to the end of the list successfully. That confuses me because I thought the range of the list would be 0-9 and not allow you to add extra values to the end of the list. So am I correct that the range is static and there's something else I don't know about in play that allows Kenneth to add 10, 11, and 12 to the list, or is the value of the range dynamic and we can just add or subtract from the list as needed?
Steven Parker218,635 Points
What he actually did was this:
our_list = list(range(10))
The "list" function converts the range (which you cannot add to) into a list that you can add to.