Code with the error

scores = [90, 75, 88]
print(scores(0))

Error message (Python 3.12, last line)

TypeError: 'list' object is not callable

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: Lists

Frequently 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.