In this tutorial, learn how to resolve the error showing TypeError: ‘list’ object is not callable’ in Python. The short answer is: use the square bracket in place of the round bracket.

This error shows that the object in the Python programming is not callable. To make it callable, you have to understand carefully the below examples. The first section of example contains the callable error showing TypeError: ‘list’ object is not callable’. While the second section showing the solution for the error.

The output of the second section example contains no error in the output. So, let’s start writing the error output and the program without error. First, start with the error example showing the TypeError: ‘list’ object is not callable’.

Code with Error : TypeError: ‘list’ object is not callable’ in Python

Here, in this example, you have to use the for loop of Python to print each element of the list. Include the print statement after the for loop to print the items of the list in Python.

However, the code contains the round bracket when passing x argument inside the print statement. This round bracket is not the correct way to print each element of a list in Python.

Output

TypeError: ‘list’ object is not callable

The above example gives error output with the error message. Read the next section to find out how to resolve the error TypeError: ‘list’ object is not callable’ in Python.

How to Resolve Error TypeError: ‘list’ object is not callable’ in Python

To resolve the problem of the error in the Python code. You have passed the variable x as the argument inside the square brackets.

But it should not appear as myList(0), myList(1) in the output. The above example showing the callable error with this round bracket as given in the above section.

Because the list variable works the same as the array element. To print each element of list variable of Python, you have to print the list as myList[0], myList[1]…myList[n]. Below is the example of for loop which gives this type of result in the output without any error.

Output

Ram
Shyam
10
Bilal
13.2
Feroz

The output of the above example gives no error and print each element in a single line.

You may also like to read

Hope, you like this tutorial of how to resolve the error TypeError: ‘list’ object is not callable’ in Python. If you have any query regarding the tutorial, please comment below.

Also tell me, which method you are using to resolve ‘object is callable’ error in Python.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.