Python code runs in jupyter-notebook, but not in IDLE - native Ubuntu installation

I am trying to run a depletion in IDLE, separate from a jupyter-notebook. If I paste the IDLE code whole into a jupyter-notebook cell, it runs the depletion without error. If I try to run it in IDLE, the depletion execution hangs - no output, no return, never finishes execution. System Monitor shows heavy CPU usage for a few minutes, then it peters out but with no execution return.

I’ve attached a very simple example - this will run if I paste it whole into a jupyter-notebook cell, but will not run as a program in IDLE. Anyone have ideas what I am doing incorrectly?

Thanks for any help. Brian
SphereTest.py (3.6 KB)

PS - this same behavior occurs when running Ubuntu in WSL2 under windows - works in jupyter-notebook, fails as native IDLE program.