1: Introduction to using Jupyter Notebooks

What is a Jupyter Notebook?

Jupyter Notebook

A Jupyter Notebook is an interactive page that allows users to code in Python and view the output.  Notebooks are divided into cells which can be run with Shift + Enter to display their output below.  In education and industry, Jupyter Notebooks are commonly used to teach Python and data science since the format helps users understand and visualize their code in a step-by-step fashion.

Follow us @ordinarycoders

2: Start learning with Jupyter Notebook

Now that you have created your virtual environment, installed JupyterLab, and opened the interface, you will learn the basics of Python using our downloadable Jupyter Notebook. The notebook contains preloaded exercises and commands to walk you through Python.


Download the Jupyter Notebook

Download Python TutorialGIF

Download: Python Tutorial Exercises

Download and save the file above into the Desktop > code > jup folder you created earlier.


Dive-in to the Python Tutorial

macOS Terminal

(jup) User-Macbook:jup user$ jupyter notebook

Windows Command Prompt

(jup) C:\Users\Owner\Desktop\code\jup>jupyter notebook

Make sure you launched the JupyterLab console with jupyter notebook from the activated virtual environment jup in the command line.  The command will run and open the interface page.


Python Tutorial Exercises in JupyterLab interfaceGIF

Once in the JupyterLab interface, click on the newly downloaded Jupyter Notebook Python_Tutorial_Exercises.ipynb in the console to begin learning the basics of Python. 

After completion, return to this page to take the quiz questions.


Close the notebook and deactivate the virtual environment

macOS Terminal

Ctrl + C
(jup)User-Macbook:jup user$ deactivate
User-Macbook:jup user$ cd ..
User-Macbook:code user$

Windows Command Prompt

Ctrl + C
C:\Users\Owner\desktop\code\jup> cd ..

Once you have completed the Python Tutorial and the quiz questions below, Ctrl + C for Windows and command + C for macOS to stop the Jupyter Notebook. Then deactivate the jup virtual environment and cd .. back to the code folder so we can begin moving between projects. As a reminder, there will no longer be parentheses surrounding the virtual environment name if the environment is successfully deactivated the environment.

If you ever want to run the Python Tutorial notebook again, simply enter back into the jup folder, activate the environment and launch jupyter notebook like we did in the step, Installing Jupyter Lab.


Follow us @ordinarycoders

Quiz Questions

1. Which of the following variables is a string?

2. What value will operator(10) return given the following function?

def operator(x):
	num = x * 3
	num = num + 2
	return num

3. What is the output of the following lines of code?

numbers = [2,3,4,5]
sum = 0
for i in numbers:
	sum = sum + i

Next lesson

Check out the comments and debug buttons if you get stuck.