Error guide · TypeError
TypeError: 'int' object is not callable
You put brackets after something that is not a function, so Python tried to call it and could not.
Example
sum = 10 numbers = [1, 2, 3] print(sum(numbers))
What Python says
TypeError: 'int' object is not callable
As printed by Python 3.12. Other versions may word it slightly differently.
Why it happens
Names such as sum, max, len and list belong to built-in functions. When you use one of them as a variable name, your value hides the function. After that, sum(numbers) tries to call the number 10, which fails. The same error appears when a missing operator leaves brackets right after a value, as in 2(3).
How to fix it
total = 10 numbers = [1, 2, 3] print(sum(numbers))
Output: 6
Tips
- Choose names that say what the value means, such as
totalorbiggest, instead of names Python already uses. - If a built-in suddenly stops working, look above for a line that gave a value to its name.
- When you meant to multiply, write the operator:
2 * (3).