Why there is 'int' object is not callable

image

Why there is an error? What is wrong with all the input?
I am sorry I am an absolute beginner…

That shouldn’t normally be the case unless there is something in the previous 30 cells that you aren’t showing that altered something.

First, start by making a new notebook and paste the code in and run it. Hopefully, that simple solution fixes it. And so it is either something in your prior code that triggered an issue or a strange problem about that kernel that developed. Here is an example of how you could cause something like this.

If a new notebook with a new kernel doesn’t fix it, your installation or environment are questionable. (Probably trying a system restart would be in order, too, before leaping to that conclusion.) I don’t have old enough Python to test what that code would give in really old Python 2. Python 2.7 is fine with it, meaning it outputs two nines on different lines as expected. I only bring up older Python on the slim chance that was involved here. Hopefully, you are using the current Python 3.

By the way, a useful place to test what Jupyter/Python should do can be accessed via your browser here. You want the classic notebook interface in upper left, unless you know you use JupyterLab. The sessions are temporary and time out unless you run something every ten minutes. Terminals are available too so you can run the Python console or use Python on the command line, too.You can even upload your files if needed, and have a virtual remote testing environment for comparing. In this specific case, you’ll see the code as you supplied works.

1 Like