Section 3 Starting out with Python and Markdown
The following image has a lot to unpack. We will see some Python cells as well as some Markdown cells. We also have a bit of Latex, as well as some of the kernel info to dive into.Let's get started with a look at the example.
First lets take a look at the Python cells. These two cells have Python code in them. We can tell that they are Python by the typeset hints, as well as by the brackets and numbers to the left of each of the cells. (1 and 4 in this case). The 1 and the 4 indicate in what order these cells were run. The reason that we don't have 1 and 2 is that the second python cell was run 3 times in development.
Each time these cell are run, some information is saved to memory. One way to know that the memory may be contributing to notebook issues is large numbers next to the cells, or numbers that are way out of order. One nice thing about Jupyter Notebooks is that we can run the cells that we like, but we do need to be carful that we are managing the memory.
These cells are Markdown cells. Markdown is a language that is used for formatting text. It can be great for keeping notes, or giving guidance in the notebooks.
The first Markdown cell is what the code will look like before the cell has been run. At this point it looks like raw text, but once compiled, the cell walls are gone, and the text fits into the notebook. We can also include Latex in the Markdown cells. Latex is also a language used for formatting text. It is often used for science, math and engineering. To write Latex code, start with $ and then write your Latex. Once you have the Latex code, close the Latex with another $.
Now let's talk about working with the cells. To run a cell, click in the cell that you would like to run, and press, Shift + Enter. This will run the one cell that we have currently selected. You can also click the "play" icon at the top of the notebook. To run the entire notebook, you can click the "fast-forward" icon at the top of the notebook, or select it from the "Run" menu.
To edit a Markdown cell, double click on the Markdown cell (If the cell has been run there won't be a boundary, so just double-click in the center). After the raw Markdown is available, make the edit that you link, and use Shift + Enter to run the cell again.
To clear the memory (kernel), select Kernel from the menu at the top of the page and choose, Restart Kernel.... This will clear the memory, but leave the output from the cells alone. You should see that all the bracket numbers are gone. This tells us that none of cells have been run. Do note that we will need to rerun any declaration cell (definitions, variables, modules...) but this blank slate can be helpful with problem solving.
Additionally, we can also choose the option, Restart Kernel and Clear All Outputs.... This will not only clear the memory, it will also clear all the cells. This is great as a way to test all the code in a notebook. Do note that none of the code (Python, Markdown, or Latex) is gone, we will just need to rerun the cells.
This is just a brief introduction to the Jupyter Lab. We have seen what some of the menus are and how to start working with the notebooks. From here it is time to explore. Start with a blank notebook and do some testing. Additionally, here are some great links to other sources of info about the Lab and the languages: