Creating multiple cells in a loop

Summarizing what is covered in ‘How to programmatically add serveral [sic] new cells in a notebook in JupyterLab’, a lot of the old ‘tricks’/‘exploits’ that worked in older versions of Jupyter Notebook (specifically 6.5 and below) don’t work in JupyterLab or Jupyter Notebook 7+ as the underlying tech is has a different architecture and has fancier abilities and features. (If some of that information about the Jupyter landscape is news to you, see the links in the second half of my answer here.)

You’ll see here that you can programmatically add cells to JupyterLab in a different way now, using ipylab.
Also note it should work in Jupyter Notebook 7+ as specified here by jtpi0:

" @giswqs this likely works in Jupyter Notebook 7 since it’s based on JupyterLab, but probably not in VS Code."