Week 1 Tutorial

GitHub Workflow and Goals for the Class

Getting Started

Ideally, you have already work through the Getting Started page on the course GitHub repository. You will need a computer that is running git, Jupyter notebook, and has all the required packages installed in order to do the homework, and some of the in-class exercises. (The exercises are intended to be collaborative, so don't worry if you don't have a laptop - but do sit next to someone who does!) If you haven't installed the required software, do it now (although the myriad of python packages can wait).

To run the tutorial notebooks in class, make sure you have forked and git clone'd the course repository. You might need to git pull to get the current tutorial, since we probably uploaded it just before class.

Mega-important!

After pulling down the tutorial notebook, immediately make a copy. Then do not modify the original. Do your work in the copy. This will prevent the possibility of git conflicts should the version-controlled file change at any point in the future. (The same exhortation applies to homeworks.)

To modify the notebook, you'll need to have it open and running in Jupyter notebook locally. At this point, the URL in your browser window should say something like "http://localhost:8890/notebooks/some_other_stuff/tutorial.ipynb"

This Week's "Tutorial"

  1. Make sure you have read and understood the Homework instructions, have forked and cloned the 2019 homework repo, and have done any other necessary computer setup. If not, or if you need technical help, this is a great time for it.

  2. The cells below contain an absurdly simple chunk of python code for you to complete, demonstrating the way that these tutorial notebooks will generally contain a mix of completed and incompleted code. Your job is to complete the code such that running the notebook will result in a string being printed out. Specifically, the string should be a brief statement of what you hope to learn from this class.

  3. Once you've produced a functional notebook, submit your solution to the Tutorial1 folder of the private repo per the usual procedure for submitting homework assignments. (Note that we will not do this for any other tutorials; this is just to make sure that everyone knows how to use the repository.)

Preliminaries

The first code cell will usually contain some import statements in addition to the following definitions.

The REPLACE_WITH_YOUR_SOLUTION and/or REMOVE_THIS_LINE functions will show up anywhere you need to add your own code to complete the tutorial. Trying to run those cells as-is will produce a reminder.


In [ ]:
class SolutionMissingError(Exception):
    def __init__(self):
        Exception.__init__(self,"You need to complete the solution for this code to work!")
def REPLACE_WITH_YOUR_SOLUTION():
    raise SolutionMissingError
REMOVE_THIS_LINE = REPLACE_WITH_YOUR_SOLUTION

This crazy try-except construction is our way of making sure the notebooks will work when completed without actually providing complete code. You can either write your code directly in the except block, or delete the try, exec and except lines entirely (remembering to unindent the remaining lines in that case, because python).


In [ ]:
try:
    exec(open('Solution/goals.py').read())
except IOError:
    my_goals = REPLACE_WITH_YOUR_SOLUTION()

This cell just prints out the string my_goals.


In [ ]:
print(my_goals)