<jupyter_start><jupyter_text>Using Jupyter Notebooks in Teaching and Learning*Welcome to the world of Jupyter notebooks.*Jupyter notebooks provide a literate programming, browser based interface and interactive development environment for a wide range of computer languages. However, they can also be used to support the reproducible production of a wide range of interactive materials and rich web based content with little - or no - programming language knowledge required.One of the main aims of these notebooks is to show how academic authors can use the notebooks to generate their own interactive activities, as well as create their own media assets, based on direct observation, and simple editing, of the provided examples.In later notebooks, you will see how it is possible to "write" a text based description of a wide range of diagram types that can be automatically rendered to a finished graphical object, appropriate either for print or web delivery. Scientific charts can also be scripted to visualise a wide range of data sets; many of these chart objects are capable of being styled without affecting the "content" of the chart, in much the same way that a web page can be styled in terms of font style and size, colouring, emphasis, and layout. The same chart objects can also be rendered as high quality charts for print display, or interactive charts more appopraite for the web.If it's embedded interactive - or static - maps you want, or embedded audio players, they can be added quite straightforwardly too.The notebooks embrace one of the original ideas of the web in that running notebooks are "read / writable". Not only do they render as HTML web pages, but you can also edit them directly, even more directly than many wiki pages.The live editing and rendering of pages means that authors can quickly update pages and see exactly how that affects the finished document.The interactive support means that notebooks allow course team members to directly author interactive activities that can be rendered in the notebooks and then used by students, as well as allowing students to create their own interactives, or write, execute and observe the output of their own code.If you are not a programmer, or don't consider yourself to be a programmer, __DON'T PANIC__. The notebooks demonstrate how you can make minor changes to the provided code in order to make meaningful changes to created objects, as well hinting at some of the more elaborate interactives that a more experienced programmer is likely to be able to produce quite rapidly.  MarkdownMarkdown cells contain *markdown*, which is a simplified markup language. Double click this cell in a running notebook to enter the cell edit mode to see the raw markdown. You may notice it reads sensibly as "annotated" text - *emphasised* elements, __strongly emphasised__ elements, as well as when rendered as HTML.(We will show you later how you can enable a rich, WYSIWYG editor as a notebook extension; but at the end of the day, writing simple markdown to create the majority of simple document stucturing and styling effects you are most likely to use is not really that hard to pick up at all!) NestingMarkdown also lets you create lists:- item 1- item 2  - subitem 1(You might also notice how easy it is to create separate levels of heading too...)To get out of markdown cell edit mode, *run* the cell using the `Run` button in the notebook toolbar, or use the keyboard shortcut `SHIFT-ENTER`. As well as markdown cells, Jupyter notebooks also contain code cells. By default, when you create a new cell (click the `+` button in the toolbar), it is created as a code cell. To change the type of a cell, click on it once to highlight it and then set the cell type from the toolbar menu. (There are keyboard shortcuts to do this too - `ESC-m` converts a code cell to a markdown cell.)See if you can create a new cell, convert it to a markdown cell, and create some of your own text, starting with a heading... If you make a mistake, `CTRL-z` will undo the change.  Running Code in Jupyter NotebooksAs well as presenting HTML styled text, Jupyter notebooks also allow to you read, write *and execute* "live" programming code; any text or media outputs created by the code can also be embedded directly in the notebook and displayed dynamically as soon as they are created.This notebook - and the other notebooks provided in this library - are primarily designed to be used with a Python 3 environment (specifically, the Azure notebooks Python 3.5 enviornment), although other languages are available, including the `R` statistical programming language. A separate Python (or R) environment is created by a Jupyter notebook server to service each running Jupyter notebook. The server manages the environment and communication between the environment and the notebook interface.Your Python code *does not* execute in the browser, it runs in the Python environment managed by the notebook server. If you check the URL you are viewing this notebook from, the domain part of the URL broadly identifies the location the server is running from.As you can probably tell, Jupyter notebooks can include text, like this.If you click once with this block of text, you should notice that the *cell* containing this text becomes selected.If you *double click* the cell, which happens to be a *markdown* cell, as identified in the notebook toolbar at top of the notebook, becomes editable.Try and type something...To return the rendered view of the cell, click the `Run` button in the toolbar, or use the keyboard shortcut: `SHIFT-ENTER`.  Code CellsSo what are code cells? You may notice that the cell directly below this one looks different. That's because it's a *code* cell. Code cells contain executable code, Python in the case of these example notebooks.To execute the code, click on the cell to select it and hit the run button (or `SHIFT-ENTER`).<jupyter_code>print('hello world')<jupyter_output><empty_output><jupyter_text>Click in a code cell to edit it. See if you can change the message in the cell above and then run it to print out your own message.Click on this cell to highlight it and then create a new code cell (the `+` button in the toolbar; you can also delete a cell using the scissors. There is an *Undo Delete Cell* option in the *Edit* menu if you make a mistake).The new cell should be created directly below this one. Click in the code area to raise an edit cursor and see if you can print out another message from that cell.  Using Python in a Code CellYou can include one or more lines of any valid python code in a code cell, including comments. When you run the code cell, the code is executed and state is updated in the normal way.Run the following code cell - does it behave as you expect?<jupyter_code>#Create a variable
a = 1
#Add to it
a = a + 1
print(a)<jupyter_output><empty_output><jupyter_text>The Python environment behind the notebook is actually an IPython environment. One of the handy features about it is that the value of a variable that is on the last line of the code cell is displayed when you run the cell.*(By now you're hopefully getting the idea that when you get to a code cell whilst reading the notebook, you should run. I'm going to assume that from now and and stop prompting you... except for this one last time: run the code cell below.)*<jupyter_code>a = a + 1
a<jupyter_output><empty_output><jupyter_text>Did that cell behave as you expected?One thing to notice is that the notebook output is preserved and does not update to show the *current state* of a variable.So if you run the code cell below, the output displayed by the code cell above could be misleading...<jupyter_code>a = a + 1
a<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.03716129032258064, 'fraction_numerical': 0.0012903225806451613, 'mean_word_length': 4.620739666424946, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '452261', 'license': 'MIT', 'n_tokens_mistral': 1824, 'n_tokens_neox': 1765, 'n_words': 1270, 'path': 'Getting Started With Notebooks/1.00 Using Jupyter Notebooks in Teaching and Learning - READ ME FIRST.ipynb', 'repo_name': 'ouseful-demos/getting-started-with-notebooks', 'size': '7750'}