Why is Jupyter not showing all the results as expected?

I am trying the following:


In [] : 1
        2
        print(3)
        4

and getting the following:


        3
Out[] : 4

why not get:

1
2
3
4

>Solution :

Jupyter just shows the last result default. You can set it like this

from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"

After run this code, you can get all of the outputs.

Leave a Reply