Skills Lab 1

Big Ideas in Computing and Information

đź‘‹Hello! Happy new semester!

new year

Welcome to the Big Ideas in Computing and Information lab. This document should familiarize you with JupyterHub and creating and editing Jupyter notebooks, something that you're going to be doing quite a lot of over the course of this semester.


Note: if you are using Anaconda, Don't forget to use the cmpinf0010 environment you created to lauch JupyterLba If you are on JupyterHub then don't worry about ib. environment

Getting familiar with the File System

Look to your left. You should see a list of files: this notebook, a, and maybe a few other files inside a lab-1 folder. That's the git repository that you just cloned; if that doesn't quite make sense to you, hang on a few weeks. We'll get there. If you're not there, you may have to navigate to the right folder; its the same as you would using the file browser on your computer.

The following exercises are your lab for this week. In future, you'll usually have a pre-made notebook where you'll fill in your answers in code or Markdown cells. For this week, follow these instructions to create your own notebook!

Exercise 1: create a new notebook

  1. Go to File → New and select "Notebook". This creates a new Jupyter Notebook file. (Alternatively, you can click the "+" icon to open a new Launcher, and create your Python 3 Notebook from there.)
  2. Select the "Python 3" kernel.
  3. Look in the file browser, right-click on "Untitled.ipynb" and click "rename." Change the name of the file to "<your Pitt username>-lab-1.ipynb". (<your Pitt username> should be your, uh, Pitt username.)
  4. Change the first cell in your new notebook to the Markdown cell by clicking on the menu that says "Code" and selecting "Markdown".
  5. Try writing some Markdown (and creating a title by using # and text after it) and executing it with Shift-Enter.

Saving your work

By default JupyterHub should autosave your work. To check and make sure you have autosave on, you can go to settings>autosave documents and ensure that its checked. We still highly recomend you save freqently though! Sometimes the autosave won't occur when you want it! The save icon is the floppy icon.


Double click

Double click on this cell. You can edit any cell in a notebook by clicking on it, and then hit Shift-Enter to evaluate the cell.

Side by side

You can view two notebooks at once (for example, this notebook and your new lab notebook) by clicking and dragging their tab within JupyterLab. Those tabs are directly above the notebook. That can be helpful for reading and following instructions without a lot of tab-switching.

Exercise 2: Markdown

Just for reference, here's that Markdown cheatsheet again.

  1. In the top cell, create a level 1 header and give your notebook a title. You can give it any title you want.
  2. Below the title, create a list with two elements: your name, and today's date.
  3. Create a new Markdown cell and put the following text at the top:
    ## Markdown Exercises
  4. Write a paragraph of text that answers the following questions. Include some bold and italic text.
    • Why are you or are you not interested in learning to code?
    • What do you hope being able to program will enable you to do?
    • Make a Markdown list of 5 things you'd like to learn from this course, from SCI, or from Pitt.

During your writing, feel free to use other Markdown styles or test out anything fancy, like writing HTML!

Exercise 3: Just a bit more of Markdown

  1. Create a new Markdown cell.
  2. Now visit and find an animated gif that represents how you feel at this moment. Click on the GIF, then click "Copy Link" and get the "GIF Link" from the page.
  3. Use Markdown image notation to insert the GIF you found into the Markdown cell. (Hint: it's a lot like link notation but more excited.)
  4. Create one more Markdown cell and insert the following text: ---

In [ ]:
print("Hi! I'm a code cell. Try changing me.")

Exercise 4: executing code in the Jupyter Notebook

  1. Create a new Markdown cell with just the following text:
    ## Jupyter Notebook Exercises
  2. Create a new code cell, then copy the following Python code into the cell and execute it:
    name = input(prompt="What is your name? ")
    print("Hello", name, "!")
  3. Create a Markdown cell underneath the code cell you just executed and describe in your own words what happened when you ran that code.
  4. Create a new code cell and copy that same code into the new code cell. Try modifying the code and executing it to see what happens. (Don't worry about making any mistakes, we're just playing around.)
  5. Create a Markdown cell underneath the code cell you just executed and describe what happened.
    • What did you try and modify?
    • Did you get an error or did it run successfully?

Exercise 5: visualizing data in the Notebook

  1. Create a new code cell and copy the following code into the cell and execute it. (The code may take a bit of time to execute, don't worry.)
%matplotlib inline
import pandas as pd
# Load the PGH 311 Complaint data
data_url = \
complaints = pd.read_csv(data_url, parse_dates=True, index_col="CREATED_ON")
# Produce a graph that shows the number of complaints per month
  1. Create a Markdown cell underneath the code cell you just executed and describe what you see. What do you think the data in this chart tell us?
  2. Create a new Markdown cell, visit, and insert an gif into the Notebook that describes how you feel.

Exercise 6: uploading your work

  1. Make sure your exercise notebook has the correct name: <your Pitt username>-lab-1.ipynb. (You won't get credit for your hard work otherwise.)
  2. Right-click on that notebook and click ↓Download. Download the file to your computer. (This varies depending on your device, but save it somewhere easily accessible.)
  3. Open Canvas and log in.
  4. Go to our Module for this week, hit submit, and upload your lab from your computer.

Good job, and see you next week.