Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeError: 'int' object is not callable

Given the following integers and calculation

from __future__ import division  a = 23 b = 45 c = 16  round((a/b)*0.9*c) 

This results in:

TypeError: 'int' object is not callable. 

How can I round the output to an integer?

like image 931
rob Avatar asked Mar 19 '12 09:03

rob


People also ask

How do I fix TypeError int object is not callable?

But in Python, this would lead to the Typeerror: int object is not callable error. To fix this error, you need to let Python know you want to multiply the number outside the parentheses with the sum of the numbers inside the parentheses. Python allows you to specify any arithmetic sign before the opening parenthesis.

How do you fix a module object is not callable?

The Python "TypeError: 'module' object is not callable" occurs when we import a module as import some_module but try to call it as a function or class. To solve the error, use dot notation to access the specific function or class before calling it, e.g. module. my_func() .

What is int object in Python?

Python int() The int() method converts any string, bytes-like object or a number to integer and returns.

What does it mean in Python when float object is not callable?

To summarize, TypeError 'float' object is not callable occurs when you try to call a float as if it were a function. To solve this error, ensure any mathematical operations you use have all operators in place. If you multiply values, there needs to be a multiplication operator between the terms.


1 Answers

Somewhere else in your code you have something that looks like this:

round = 42 

Then when you write

round((a/b)*0.9*c) 

that is interpreted as meaning a function call on the object bound to round, which is an int. And that fails.

The problem is whatever code binds an int to the name round. Find that and remove it.

like image 72
David Heffernan Avatar answered Sep 29 '22 21:09

David Heffernan