Day 2

Summary of Course Entrance Survey

Reading Journal Debrief

With two people sitting around you, go over your reading journal. Identify any questions / difficulties and try to work through them. We will do a quick report out for lingering confusions along with observations you’d like to share with the rest of the class.

Modular Design Exercise

In groups of 3, review the solutions from a previous iteration of this class to Chapter 3, Exercise 5, Part A.

What aspects of these different designs:

In groups, redo Chapter 3 Exercise 5 based on the design that your group decides is most readable and most flexible.

In a surprise move, your manager has asked you to implement two new features for your program.

  1. Write a function that draws the following grid

    + - - - - + - - - - + - - - - + - - - - + - - - - +
    |         |         |         |         |         |
    |         |         |         |         |         |
    |         |         |         |         |         |
    |         |         |         |         |         |
    + - - - - + - - - - + - - - - + - - - - + - - - - +
    |         |         |         |         |         |
    |         |         |         |         |         |
    |         |         |         |         |         |
    |         |         |         |         |         |
    + - - - - + - - - - + - - - - + - - - - + - - - - +
    |         |         |         |         |         |
    |         |         |         |         |         |
    |         |         |         |         |         |
    |         |         |         |         |         |
    + - - - - + - - - - + - - - - + - - - - + - - - - +
    
  2. Modify your function to take in two additional inputs that specify the dimensions of width and height (in characters) of each of the boxes that compose the grid. For instance,

    grid(6, 3) produces

    + - - + - - + - - + - - + - - +
    |     |     |     |     |     |
    |     |     |     |     |     |
    + - - + - - + - - + - - + - - +
    |     |     |     |     |     |
    |     |     |     |     |     |
    + - - + - - + - - + - - + - - +
    |     |     |     |     |     |
    |     |     |     |     |     |
    + - - + - - + - - + - - + - - +
    

Running Python Code

There are many ways to run the Python code you write:

Method 1: Interactive Python interpreter

$ python3
Python 3.7.1 (default, Dec 14 2018, 19:28:38) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print("Hello, SoftDes!")
Hello, SoftDes!

There is also an advanced implementation of the interpreter called ipython that adds some nice extra features.

Method 2: Jupyter notebooks

This is what you used for the Reading Journal. Each code cell in the notebook is essentially a mini interpreter session.

Method 3: Within IDE/editor

Several integrated development environments/text editors allow you to run Python code as you write it. The mechanism for doing so varies by editor. In order to run Python code from Atom, you should install the “script” package (detailed instructions on installing packages), and then use ctrl-shift-b to execute your code.

A few things to watch out for: when you run code using this method it usually can’t take standard input, so this means you can’t use e.g. the raw_input function. Also, if you run an infinite loop it may freeze your editor!

Method 4: Saved script

Finally, you can save your program as a text file (with a .py extension by convention) and run it at the command line:

$ python3 my_script.py
"Hello, SoftDes!"

This is the preferred method for all but the very simplest programs, and is how you will complete all the assignments in this class other than reading journals.

Gene Finder (Mini-Project 1) Kickoff

We’ll be going some background information related to mini-project 1 (slides)

Resources on Protein synthesis