CPSC 128
Course Notes and Assignments
- Week 0. Course Preparation
-
- Task List
- Course Information
- Installing
Python
- Logging in to MyYC for the first time [PDF]
- Configuring email forwarding in MyYC [PDF]
- Week 1. Course Introduction
-
- Week Overview (includes task list!)
- Introduction to Computers and Programming
- Using the Python shell
- Assignment 1
- Week 2. SIPO (Sequential Input, Processing and Output) Programming
-
- Overview
- Recall:
Programming is...
- Our first program: f2c
- [Screencast] Running your first program
- Naming
Values
- Onscreen
Appearance
- Documentation
- Our
second program: c2f
- Our
third program: dhms2s
- SIPO
Summary
- Packaging Quantities
- Modulo
- Symbolic
Constants
- Intermission:
Summary
- Object
Types 1: Integers and Floating Point
- Example:
Radius of a tree
- Example:
Value of change
- Example:
Making change
- Example:
Area of an Oil Spill
- Some Pythonic Details
- Marking
Scheme
-
Assignment 2
- Week 3. Selection Control Structures
-
- Week
3 Overview
- A
Simple Example: Positive or Negative?
- A
Correction
- if
Statement Syntax
- Relational
Expressions
- Compound
Statements and Indentation
- Example:
Converting Fahrenheit to Celsius or vice versa
- Case Study: Converting numerical grades to letter grades
- A
final (very small) example: Abs
- Summary
- Example:
Gazinta
- Example:
Pythagorean theorem
- Example:
Utility Bills
- Example:
Beaufort Scale
- Pythonic Details
- Assignment 3
- Week 4. Repetition Control Structures
-
- Week
4 Overview
- The Basics
- Applications
- Pythonic Details
- Assignment 4
- Week 5. Aggregate data types 1: Lists & Strings
-
- Object-Based
Programming
- Sequence
Types
- Lists
- Strings
- List Mechanics
- Lists for Representation
- Multidimensional Lists (Lists of lists)
- String Processing
- Pythonic Details
- Assignment 5
- Week 6. Functions and Modules
-
- Modularization
- Functions
(& their jargon)
- Writing Functions: is_even()
- Writing
Functions: Syntax
- Example:
is_odd
- Example:
dice_roll
- Default
arguments
- Example:
Playing Card Functions 1
- Reusing
functions
- Modules
- Documenting
Modules and Functions
- Summary:
Module Layout
- Example:
Playing Card Functions 2
- Refining
import
- Scope
- The
perils of mutability
- Reference
Semantics (& diagramming memory)
- Using
vs changing a list
- Copying
a list
- Pythonic Details
- Assignment 6
- Week 7. Aggregate data types 2: Dictionaries
-
- Introduction
- Dictionary
"derivation"
- What
can you do with a dictionary?
- Example:
Word Frequencies
- Example:
Scrabble scoring
- Example:
Book database
- Example:
A list of dictionaries
- Assignment 7
- Week 8. Persistence: Processing text files
-
- Persistence
- A
note to the student
- Text
versus binary files
- Reading
from text files
- Example:
Searching log files
- Important
note: Files are sequential
- Is
there more?
- Writing
to text files
- Appending
to files
- Reading
numeric data
- Designing
file formats
- Pickling
- Shelves
- Gotcha!
Shelves update on assignment not mutation (?!)
- A
controller for our database
- The
main event loop
- Assignment 8
- Week 9. Object-Oriented Programming 1: Encapsulation
-
- Object-Oriented
Programming
- Encapsulation
- Inheritance
- Polymorphism
- The
Plan for the next three Weeks
- A
small example: A dice class
- Python
OOP Syntax
- An Extended Example: Playing Card Classes
- A
programming observation
- Assignment 9
- Week 10. Object-Oriented Design (OOD)
-
- Object
Oriented Design
- Extended example: Hunt the Wumpus
- Assignment 10
- Week 11. Object-Oriented Programming 2: Polymorphism &
Inheritance
-
- Inheritance
and Polymorphism
- Inheritance
- Aside:
Refactoring
- Polymorphism
- Assignment 11
- Week 12. Unified Modelling Language (UML); Testing
-
- UML
and Testing with doctest
- Unified
Modelling Language (UML)
- Aside:
is-a versus has-a
- UML
class diagram visual syntax
- UML
Example: Playing card classes
- Testing
with doctest
- Assignment 12 (The last one!)
- Exam Preparation
-
- Examinable
Topics
- Sample
Final Exam