Note: this site is still up to serve as a reference for people who took the course in Fall of '18. If you're currently enrolled, please head to the site for the current semester.

Lecture Schedule

Part 1: Basic Programming

Week 1

Tue: (Sep 4)
No Class
Thu: Introduction + Terminal (Sep 6)
  • Basics of computers (CPU, memory, disks)
  • Main memory vs hard disk
  • What is programming?
  • Terminal basics
  • Course overview
Link to Slides
Terminal basics

Week 2

Tue: How computers work? (Sep 11)
  • Shell commands (pwd, ls, cd, etc.)
  • Absolute vs relative path
  • Pseudocode
  • State
  • Flow of execution
Shell Commands
Link to Worksheet
Due (Wed): Project 0 (ungraded)
Thu: Basics of Programming (Sep 13)
  • Interpreter, editor, and IDE
  • Running python
  • Arithmetic operators
  • Logical operators
  • Values and types
  • Boolean logic
  • Interactive vs. script mode
Operators
Link to Notes
Read: Think Python (Chapter 1)

Week 3

Tue: Variables (Sep 18)
  • Operator precedence
  • Assignment operator
  • Variables
  • Naming variables
  • Bugs (errors)
Link to Notes
Read: Think Python (Chapter 2)
Homework (not graded): Homework 1
Expressions (for practice): expressions.py
Due (Wed): Project 1
Thu: Functions (Sep 20)
  • Why functions?
  • In-built functions (e.g., input())
  • Math functions (e.g., factorial())
  • Writing your own functions
  • Parameters and arguments
  • Return values
Notes on Functions
Link to Notes
Code Snippets: quadratic_roots.py, quadratic_roots_input.py, inbuilt_functions.py, math_functions.py, write_functions.py
Read: Think Python (Chapter 3)
Read: Creating Fruitful Functions

Week 4

Tue: More Functions (Sep 25)
  • Control flow during a function call
  • Scope of variables in a function
  • Stack diagrams(Frames)
Link to Slides
Link to Notes
Code Snippets: More Functions
Read: Think Python (Chapter 3.6 - 3.12)
Due (Wed): Project 2
Thu: Conditionals and Iteration (Sep 27)
  • Simple conditionals
  • Chained conditionals
  • Nested conditionals
  • Loops
  • While loop
Code Snippets: Conditionals & Loops
Link to Notes
Link to Slides
Read: Think Python (Chapters 5.1 - 5.7, 6.1 - 6.4, and 7)

Week 5

Tue: Advanced Conditionals and Loops (Oct 2)
  • Multiple elifs
  • Nested if-else
  • More on while loop
  • break statement
  • continue statement
  • Nested loops
Code Snippets: Advanced conditionals + Loops
Link to Notes
Read: Think Python (Chapters 5.1 - 5.7, 6.1 - 6.4, and 7)
Due (Wed): Project 3
Thu: Strings (Oct 4)
  • String basics
  • Indexing
  • len() function
  • for loop
  • String methods
  • Searching
  • Slicing
Code Snippets: Strings
Link to Notes
MIDTERM EXAM 1
Read: Think Python (Chapter 8)
Part 2: Working with Data

Week 6

Tue: Lists (Oct 9)
  • Strings Review
  • Sequences
  • Indexing and Slicing
  • Mutable vs Immutable
Read: Think Python (Chapter 10)
Link to Notes
Code Snippets: Lists
Due (Wed): Project 4
Thu: Lists and CSV Files (Oct 11)
  • List methods
  • Split and Join
  • CSV files
Lecture Notes: Lists and CSVs
Code Snippets: Lists+CSVs
Read: Think Python (Chapter 10) and AutomateTheBoringStuff (Chapter 14 - upto but not including Writer Objects)

Week 7

Tue: Dictionaries (Oct 16)
  • Syntax
  • Key-Value pairs
  • Lookup
  • Insert
  • When is a dictionary useful?
Lecture Notes: Dictionaries
Code Snippets: Dictionaries
Read: Think Python (Chapter 11.1 - 11.3)
Due (Wed): Project 5
Thu: Advanced Dictionaries (Oct 18)
  • Delete a Key-Value pair
  • Nesting
  • dicts with lists
  • Dealing with JSON
Lecture Notes: Advanced Dictionaries
Lecture Slides: Table representation
Code Snippets: Advanced Dictionaries
Read: Think Python (Chapter 11.5 and 11.7) and AutomateTheBoringStuff (from "JSON and APIs" until "Writing JSON with the dumps() Function" (included))

Week 8

Tue: JSON, Tuples, and Objects (Oct 23)
  • Binning
  • Deserialization
  • Serialization
  • Pretty Printing
  • Tuples
  • Intro to References
Lecture Notes: JSON & Tuples
Lecture Slides: JSON and Tuples
Code Snippets: JSON & Tuples
Read: Think Python Chapter 10 ("Objects and Values" and "Aliasing") and Ch 12
Due (Wed): Project 6
Thu: Objects, References, and Copying (Oct 25)
  • Objects
  • References
  • Shallow Copy
  • Deep Copy
Read: AutomateTheBoringStuff Chapter 4 ("References" through the end)
Code Snippets: Objects, References, Copying
Lecture Notes: Objects, References, Copying

Week 9

Tue: Recursion (Oct 30)
  • Base/Resursive Cases
  • Lists of Lists
  • More Stack Diagrams
  • Stack Overflow
Code Snippets: Recursion
Lecture Notes: Recursion
Read: ThinkPython Ch 5 ("Recursion" through "Infinite Recursion"), Ch 6 ("More Recursion" through end)
Due (Wed): Project 7
Thu: Advanced functions (Nov 1)
  • Iterators and generators
  • References to functions
Read: Advanced Functions
Code Snippets: Adv funcs
Lecture Notes: Advanced Functions

Week 10

Tue: Exceptions and Files (Nov 6)
  • Handling exceptions
  • Reading and writing files
Read: AutomateTheBoringStuff Ch 10 (beginning through "Assertions") and ThinkPython Ch 14
Lecture Slides: Exceptions and Files
Lecture Notes: Exceptions and Files
Code Snippets: Exceptions and Files
Thu: Pandas (Nov 8)
  • iPython notebooks
  • series
  • element-wise operations
Reading: CS 301 Notes (Notebook)
Lecture Notes: Pandas
Ipython Notebook: Lecture19.html
MIDTERM EXAM 2
Part 3: Data Science

Week 11

Tue: More pandas (Nov 13)
  • Data Frames
  • Reading CSVs
  • Processing CSVs in Pandas
Ipython Notebook: Lecture20.html
Due (Wed): Project 8
Thu: Web (Nov 15)
  • Servers/Clients
  • URLs
  • HTTP: GET and POST
  • requests module
  • Intro to HTML
  • Generating HTML
Lecture Slides: Requests
Read: Sweigart Ch 11

Week 12

Tue: More Web (Nov 20)
  • Intro to HTML
  • Generating HTML
Lecture Slides: HTML
Due (Wed): Project 9
Thu: ThanksGiving Break (Nov 22)
NO CLASS - Happy Thanksgiving! :)

Week 13

Tue: Databases (Nov 27)
  • tables
  • SQLite
  • queries
  • where
  • order by
  • limit
Lecture Slides: Databases
Bus database:bus.db
Thu: More Databases (Nov 29)
  • Querying from Python
  • Querying from Pandas
  • aggregates
  • group by
  • having
Lecture Slides: Advanced Databases
Movies database:movies.db

Week 14

Tue: Plotting (Dec 4)
  • pie charts
  • scatter plots
  • plot design
Reading: Pie chart and scatter plots (Notebook)
Thu: More Plotting (Dec 6)
  • Axes subplot
  • line plots
  • bar plots
Reading: Line and bar graphs (Notebook)
Fire Hydrants CSV:Fire_Hydrants.csv

Week 15

Tue: Advanced Plotting (Dec 11)
  • axes
  • adjacent plots
  • design decisions
Reading: Axes (Notebook)
Due (Wed): Project 10 (Final Project)