CS 1210

Author

Clayton Cafiero

Published

June 11, 2025

Computer science is a science of abstraction—creating the right model for a problem and devising the appropriate mechanizable techniques to solve it.

–Alfred V. Aho

Abstraction is deliverance.

–James Brandon Lewis

Introduction to Programming

Presented here is a subset of materials for use in CS 1210 Introduction to Programming. What follows is incomplete, and subject to revision, deletion, and rearrangement.

Textbook: Cafiero, Clayton. 2023–2025. An Introduction to Programming and Computer Science with Python. ISBN: 979-8-9887092-0-6. Hard copy available in UVM Bookstore (price should be $14.00). Revision history (from first print edition forward)

Feedback, including reports of errata, criticisms, suggestions, and proposed revisions, is warmly encouraged.

Second edition in the works

The second edition of the textbook is almost done, and I expect to have it completed by August 2025. Here’s a draft (incomplete, and content subject to change): An Introduction to Programming and Computer Science with Python, Second Edition. ISBN: 979-8-9887092-1-3.

Second edition adds the following:

  • expanded treatment of functions and scope, with coverage of free variables and Python’s LEGB resolution strategy;
  • coverage of UnboundLocalError and UnicodeDecodeError exceptions;
  • coverage of Python’s built-in sorted()
  • coverage of string methods .replace(), .join(), and .split();
  • coverage of sequence method .count();
  • using the keyword is to test for identity;
  • coverage of list method .extend();
  • coverage of random module functions .gauss() and .sample() and math module functions .exp(), .log(), .log2(), .log10(), .floor(), .ceil(), .degrees() and .radians();
  • sets;
  • expanded treatment of structured data including named tuples and the json module;
  • use and abuse of the global keyword;
  • strategies for dealing with long lines and PEP 8; and
  • new appendices: Code smells for beginners, An even deeper dive into functions, The joy of Unicode, and An introduction to databases with SQLite

Preliminaries

Since we’ll be writing programs in Python, you’ll need… Python!

Selections from the textbook

Here are selections from the textbook, An Introduction To Programming and Computer Science With Python, and some supplemental videos.

01: Introduction

02: Programming and the Python Shell

03: Types and literals

04: Variables, statements, and expressions

05: Functions

06: Style

07: Console I/O

08: Branching, comparisons, and conditions

09: Structure, development, and testing

10: Sequences

11: Loops, iteration, and iterables

12: Randomness, games, and simulations

13: File I/O

14: Data analysis and presentation

15: Exception handling

16: Dictionaries and structured data

17: Graphs

Appendices