worksheet01-checkpoint
COMP90051 Welcome Notebook¶
Welcome to Jupyter Notebook—an interactive environment that mixes code, visualisations and text.
Jupyter Notebook supports many programming languages (called “kernels” in the Jupyter lingo). In this course, we’ll mainly be using Python 3 due to its popularity in the machine learning/data science communities. Information about the kernel is diplayed in the top right of the UI.
Cells¶
Notebooks are made up cells: markdown cells and code cells.
This cell is an example of a markdown cell.
Markdown cells can contain text, tables, images, equations, etc.
(see the Markdown guide under the Help menu for more info).
You can edit a markdown cell by double-clicking on it.
To evaluate the cell press the button in the toolbar, or hit
Try it below!
— Edit me —
Next are some code cells.
You can evaluate them individually, using the button or by hitting
Often, you’ll want to run all cells in the notebook, or below a certain point. The functions for doing this are in the Cell menu.
In [1]:
message = “Hello world!”
In [2]:
print(message)
Hello world!
In [ ]:
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
x = np.arange(0.0, 2.0, 0.01)
y = (x – 1)**2
plt.plot(x,y)
plt.ylabel(“y”)
plt.xlabel(“x”)
plt.title(“Parabola”)
plt.show()
Interrupting/restarting the kernel¶
Code is run in the kernel process. You can interrupt the kernel by pressing the stop button in the toolbar. Try it out below.
In [ ]:
import time
time.sleep(10)
Occassionally you may want to restart the kernel (e.g. to clear the namespace). You can do this by pressing the button in the toolbar. You can find more options under the Kernel menu.