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.
pawkan kenluecha26,303 Points
Is it still valid to use "range()" ?
I tried to use this code in console and I got this error.
our_list = list(range(10))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'range' object is not callable
What is the meaning of this ? Is this still possible to use ?
The only thing that I can see is that you are redefining range somewhere before that in your code. When I redefined range, then I got the same error as you, but without redefining it,
list(range(10)) should work fine.
Alex DonaldCourses Plus Student 13,129 Points
I had this issue because I had previously used "list" as a variable. Therefore Python was trying to pass the range to my list. Perhaps I should be more inventive with variable names!