'list' object is not callable = error | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

'list' object is not callable = error

i'm using python3.7 when i run this numbers = list(range(10)) this generates error 'list' object is not callable any solution?

19th Aug 2018, 12:22 AM
Parveen Kumar
Parveen Kumar - avatar
12 Answers
+ 10
As Flandre Scarlet has pointed out you might have done something like this => >>> list = [] >>> list(range(10)) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'list' object is not callable >>> That's why you are getting this error because you have overwritten the built-in list() function with a variable containing a list or some other object.
19th Aug 2018, 8:56 AM
OR!ON 🛡️
OR!ON 🛡️ - avatar
+ 5
you may have named something to be 'list', so that 'list' is not a function anymore
19th Aug 2018, 2:46 AM
Flandre Scarlet
Flandre Scarlet - avatar
+ 4
are you attempting to make a list with the numbers 0-9? Try this.. numbers=[i for i in range(10)] Look into List Comprehension
19th Aug 2018, 1:28 AM
LordHill
LordHill - avatar
+ 3
you should try: numbs = [i for i in range(0, 10)] as Rick Morty said this will create: numbs = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] this can be written as: numbs = [] for i in range(0, 10): numbs.append(i) but that would be very inefficient and not recommended
19th Aug 2018, 9:01 AM
Timothy Joseph
Timothy Joseph - avatar
+ 3
Please upload your coding anything else is Teesatzleserei(German) or asking the oracle of Delphi
19th Aug 2018, 9:08 AM
Oma Falk
Oma Falk - avatar
+ 2
numbers = list(range(10)) this is working now ! i dont know how there was an error ! bytheway thankuh Peeps for Your time !
20th Aug 2018, 10:35 AM
Parveen Kumar
Parveen Kumar - avatar
+ 2
Ooflamp It's designed that all built-in functions can be overwritten so that you can use them as how you want to
18th Mar 2019, 10:25 AM
Flandre Scarlet
Flandre Scarlet - avatar
+ 1
Why you got error this is right. numbers=list(range(10)) print(numbers)
19th Aug 2018, 2:44 AM
Maninder $ingh
Maninder $ingh - avatar
+ 1
I am using Python3.7 too but this code can work and output right result Check you code again
19th Aug 2018, 9:34 AM
S@l
0
Why does python allow name collision?
18th Mar 2019, 7:44 AM
Ooflamp
Ooflamp - avatar
0
Oh okay, Thanks
19th Mar 2019, 3:25 AM
Ooflamp
Ooflamp - avatar