All Python errors
TypeError: 'list' object is not callable
This message means a list is followed by round brackets, as if it were a function. To take an item write square brackets, items[0]; if you named a variable list, rename it so the built-in list() works again.
Code with the error
scores = [90, 75, 88]
print(scores(0))
Error message (Python 3.12, last line)
Corrected code
scores = [90, 75, 88]
print(scores[0])
Output
90
Common causes
- items(0) instead of items[0].
- A variable called list hides the function list().
- A variable has the same name as a function you call later.
- A missing operator or comma before an opening bracket.
Practise in the course
Lesson: ListsFrequently asked questions
What does callable mean?
Something you can run with round brackets: a function, a method or a class.
Why is list a bad variable name?
It replaces the built-in function with your value, and list(...) stops working below that line.