Skip to content
Advertisement

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?

Advertisement

Answer

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.

Advertisement