Day 2
Summary of Course Entrance Survey
- There is (as expected) a fairly wide range of prior experience with both Python and programming in general. Your responses will be useful in helping us customize the class for you going forward.
- Commonly mentioned learning goals
- gain comfort with coding
- learn professional software practices (e.g., version control with git)
- spark interest in CS and see if it is for me
- learn about computation in field X or using specific technology Y (some of these are covered in the course already, some could be the focus of a final project)
- become confident in explaining and communicating about code
- start to build a portfolio of software projects
- learn Linux + command line
- write better (neater, more readable, more robust) code
- practice reading code and documentation
- team with others on a software project
- get better at asking for help
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:
- Increased / decreased the readability of code (readability means your ability to easily deduce what the code does, how it works, and whether or not it is correct).
- Increased / decreased the flexibility of the code (flexibility means the ability of this code to be easily modified to satisfy new requirements that may aris)e.
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.
-
Write a function that draws the following grid
+ - - - - + - - - - + - - - - + - - - - + - - - - + | | | | | | | | | | | | | | | | | | | | | | | | + - - - - + - - - - + - - - - + - - - - + - - - - + | | | | | | | | | | | | | | | | | | | | | | | | + - - - - + - - - - + - - - - + - - - - + - - - - + | | | | | | | | | | | | | | | | | | | | | | | | + - - - - + - - - - + - - - - + - - - - + - - - - +
-
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
- https://www.youtube.com/watch?v=bKIpDtJdK8Q
- https://www.youtube.com/watch?v=2zAGAmTkZNY
- https://www.khanacademy.org/science/biology/gene-expression-central-dogma/central-dogma-transcription/a/the-genetic-code-discovery-and-properties
- https://www.youtube.com/watch?v=jtQXIf31Vqw