DLC: Python, the Command Line, and VS Code
Live Demo!
<aside>
🧭
This Lecture
Covers
- Getting Started: the terminal, Python 3.13, VS Code, and forking, cloning, and syncing a GitHub repository.
- Command Line Essentials: paths, navigation, file operations, redirection, pasted shell scripts, and shell shortcuts.
- Python Basics: interactive and script mode, indentation, values and types, strings, lists, arithmetic, and comparisons.
- Control Structures:
if decisions, for loops over readings, and while loops with break and continue.
- Debugging: reading a traceback and fixing
IndentationError, NameError, TypeError, and ValueError.
- Readings: McKinney, Python for Data Analysis (3rd ed.) 2.1 and 2.3; Shotts, The Linux Command Line, Chapters 1 to 4, 6, and 24; MIT Missing Semester, "Course Overview + The Shell" and "Version Control (Git)".
Enables
- Fork and clone a GitHub repository in VS Code, edit a file, then commit and sync the change back to GitHub.
- Set up a project folder from the terminal with
mkdir, cp, and mv, and peek at a clinic CSV with head and cat.
- Paste a shell script into a file with
cat > file.sh and run it with bash file.sh.
- Write and run a Python script that computes BMI, then read its traceback to fix a misspelled name or a text-to-number error.
- Classify systolic readings against blood-pressure cutoffs with
if/elif, and average them with a for loop.
</aside>
Quick References
<aside>
🌉
San Francisco is a walkable city and I will literally die on this hill
</aside>
Class Structure
This course started as a Python introduction plus as much of the practical stuff I learned on the job but never in a course as I could fit. Halfway through preparing the first version, I found The Missing Semester. Apparently, I wasn't the only one who noticed the gap.
- Lectures cover new material
- Assignments after each lecture (caveats apply)
- Lab for hands-on help completing the practical assignment
- Assignments (60%) are always due the following week unless otherwise noted
- Two exams (40%) or just one for 1-unit course at weeks 5 and 11
Getting Started: Your First Steps
What is the Command Line?
The command line (CLI) is a text-based interface.
Think of it as texting your computer instead of playing charades with icons.