Jupyter Notebooks

Jonathon Sumner
Physics Department
Dawson College
Sameer Bhatnagar
Physics Department
Dawson College
March 8, 2020
March 8, 2020

Meeting 3

Sometimes we want to run code in our reports.

Try it

You can give Jupyter Notebook a try online at: https://jupyter.org/try . Just select Python and follow the instructions.

Installing Jupyter

With Python3 set up, all we need to do is activate our virtual environment and install using pip.

Code sample: Installing Jupyter in our virtual environment
(venv_cnc) jsumner$ pip install jupyter

To start Jupyter Notebook:

Code sample: Starting up Jupyter Notebook
(venv_cnc) jsumner$ jupyter notebook

Postscript

In the end, we didn't talk much about Jupyter Notebooks. Instead, we defeated the first four levels of the Python Challenge. If you want to catch up, here are the hints:

  1. Level 0 > 2**38
  2. Level 1 > You need to manipulate the code to shift all the letters by 2. We came up with a few solutions to this one: the pythonic answer involves the str.maketrans() method but you can also tackle it by manually looping over all the letters in the code.
  3. Level 2 > Right-click the page and 'View Page Source'. In the mess of characters, find the ones that would occur in a book! Again, we came up with a few solutions, the most pythonic one involves the re module. Also, we looked at a handy command to make a string from a list: "".join(<list>).
  4. Level 3 > Same idea as Level 2, but a bit more complex.