1

I am a Python instructor creating Jupyter Notebooks with exercises for my students to complete.

I want each cell in the notebook to ignore any variables defined in previous cells.

I know I can reset the namespace in any cell with %reset -fs, but I would prefer that the notebook itself issue a %reset -fs implicitly upon any cell execution, or alternatively for the notebook to be otherwise configured not to share variables between cells.

Such sharing of variables, while a useful feature in Jupyter, can cause errors that are difficult for students to trace - for example if they mistakenly reassign sum = 5.5 in one cell and then attempt to use sum() in a later cell.

They are new enough learners that they can become easily confused by this even after they have been told to look for it.

David B.
  • 727
  • 1
  • 5
  • 9
  • The answer to this question may help: https://stackoverflow.com/questions/42245170/how-to-enable-timing-magics-for-every-cell-in-jupyter-notebook – Craig Jul 06 '19 at 20:49

0 Answers0