tkf/emacs-ipython-notebook

Jupyter seems to only print out the last out of all cells

sirtosti opened this issue · 4 comments

in this small python code , only the last result is output when use "Ctrl + enter" or cell-->"run all"

here is the little code:

"alphabetical".isupper()
"alphabetical".islower()
"alphabetical".istitle()
"alphabetial".isdigit()

False -----So, this line is the output of "alphabetial".isdigit()" and it didn't execute the other three.

dzbee commented

This is typical notebook behavior. The others did execute, but the cell only prints the result of the last evaluation to console. If you put print statements in front of each line, all them will print.

dzbee commented

Jupyter/IPython will only print the result of the last evaluation in a cell to console unless explicitly told to print the result of an evaluation by the print command. It doesn't matter whether the expression is a Boolean or a complicated function. This is a general Jupyter/IPython behavior. As I said before, if you put print statements in front of each line, all of them will print. You could also split them into separate cells and all of them will print. I would highly suggest looking at a Jupyter notebook tutorial if you are confused about what's happening here.