Python error: ‘int’ object is not callable

TypeError: ‘int’ object is not callable ‘; ‘int’ object cannot be called .

I just want to use the sum of the 1-100, and () function, but an error, because I’m using ipython, I at first thought it was the cause of the ipython, then I will bring in python interactive tool test, found that there is no problem, can be normal use, the following figure:

I then looked at me in ipython before operation, before the “sum” this keyword is defined as a variable name, then I tried to put their own custom variables to deleted, please try again after deleting, found, it was the sum () function is when the cause of the variable name before, It’s attempt to:
lookup is defined before the variable name

by reset delete custom variable

try again, can be normal use

this is my problem and the solution, the hope can help you!
hint: python variable names and method names should not be the same


Read More: