Thank you very much for sharing that. I am happy to tell you that your Jupyter Notebook just works fine. It is your expection that needs to be adapted. The Jupyter Notebook only shows what the last statement of a cell evaluates to.
-
If you define a function, this does not evaluate to anything that could be displayed. So you can’t see anything in the upper cell.
-
In the function in the upper cell, you set the result equal to some value. But you never return the result. As you don’t have ANY return statement in the function, Python replaces that with
None. Your expressionsresult = XXXmean nothing as you don’t return that result. The chosen nameresultwas freely chosen by you and has no language-specific meaning in Python. After invoking your function, Python happily deletes that variable and does nothing else. -
As the function invocation returns
None, for the lower cell there is nothing to display.
So I can tell you that everything is working fine. I wish you happy coding and nice experiences with learning Python! I hope you can find nice books or online classes that might help you with your journey.