Session 1: Introduction to Jupyter Notebook#

Perform the following Jupyter notebook operations:

  • Run notebook

  • Change a cell and re-run the cell

  • Add a new line/cell to a notebook

  • Download the workshop material with code cell

  • Unzip the downloaded zip file with code cell

Please follow the instruction at each cell.

1. Run notebook#

Please run the code cell below:

message = "Hello World"
print(message)

2. Change cell and re-run the notebook#

Modify the message of the print statement below to say “Hello IN-CORE” and run the current cell.

message = "Hello World"
print(message)

3. Add a new line and execute it#

Add a new cell below to this notebook. On the new line, modify the message variable to print your name.

4. Download a zip file of the workshop material#

URL: https://www.dropbox.com/s/o5w9nusgs6sqmez/in-core-workshop.zip?dl=0

Please run the following code to download a zip file. Please make sure that it appears in your file browser (left panel)

# import requests module
import requests
# set URL and get file contents
url = 'https://go.ncsa.illinois.edu/workshop-zip'
filename = 'in-core-workshop.zip'
headers = {'user-agent': 'Wget/1.16 (linux-gnu)'}
r = requests.get(url, allow_redirects=True, stream=True, headers=headers)
# write the contents to a file
open(filename, 'wb').write(r.content)

5. Unzip the downloaded zip file#

Please run the following code to unzip the downloaded zip file. Please make sure that all the workshop materials appear in your file browser (left panel) NEED TO INSERT the screenshot

# import zipfile module
import zipfile
# extract the zipfile
with zipfile.ZipFile(filename,'r') as zip_ref:
    zip_ref.extractall()