Jupyter provides a nice web-based interface to Python. In the below cells you can type a line of Python. For example, here we type in
a = 5
When we press
SHIFT+Return this Python line is interpreted interactively
a = 5
To see that this has worked, let's print the value of
You can type whatever Python you want, and it will be evaluated interactively. For example...
b = 10
print(a + b)
One of the cool things about a Jupyter Python notebook is that you can edit the above cells and re-execute them. For example, change the value of
b above and re-execute the lines  and  (by selecting the cell and pressing
Another cool thing is that you can mix documentation into your notebook. Do this by selecting a cell and using the dropdown menu to change the cell type to
Markdown. You can now add documentation, using markdown formatting. For example, use the hash symbol for headers...
You can add in hyperlinks using square brackets and round brackets, for example link to course.
All of the standard Python help is available from within the notebook. This means that you can type
to get help about
something. For example, type and execute
help(print) to get help about the print function...
Help on built-in function print in module builtins: print(...) print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False) Prints the values to a stream, or to sys.stdout by default. Optional keyword arguments: file: a file-like object (stream); defaults to the current sys.stdout. sep: string inserted between values, default a space. end: string appended after the last value, default a newline. flush: whether to forcibly flush the stream.
You can set the name of the notebook by clicking on the name at the top, and setting the name. The notebook is saved to a file called
name.ipynb (ipynb means 'interactive python notebook'). You can save the notebook using the
File menu at the top, using
Download as e.g. saving as a normal Python script, or as a PDF file, webpage or downloading the python notebook itself.
You can run this notebook on your own computer by installing Jupyter. More information is available at the Jupyter website.
Use the cells below and to type into the three Python lines
a = "Hello" b = "World" print(a,b)
Execute the cells. This should print out
Now go back and change the values of
Everyone. Re-execute your cells. This should now print out
a = "Hello"
b = "World"
Here is some markdown
list item 2
numbered list item
Finally, use the interactive Python help to get help about the
open function for reading and writing files.