Type error str object is not callable

Hi,

I have revisited the problem of factorial and tried to code in google colab but for the same code, which got executed earlier, now it is showing error.
Unable to understand this.
Please help

Thanks.

def factorial_recursive(n):
if n>1:
return n * factorial_recursive(n-1)
else:
return 1
print(factorial_recursive(3))


TypeError Traceback (most recent call last)
in ()
----> 1 print(factorial_recursive(3))

TypeError: ‘str’ object is not callable

Have you tried by rerunning all the cells? Including the one containing function definition.

Yes, but same issue. When i ran in a new terminal it got executed.
But i wanted to know about this problem from you as it happened a couple of times before. Correct codes also show error.

Can you share the link of your code

Though I’m not sure why this happens in colab, and most of the times gets resolved as we restart the runtime.
But “TypeError: ‘str’ object is not callable” refers that a variable that was declared as string-type earlier, is now attempted to be used as a function (e.g. by adding parantheses in the end)