Index / 001 EN
Introduction to Computation and Programming Using Python cover

Computer Science

Computer Science

Introduction to Computation and Programming Using Python

John V. Guttag

A thorough introduction to computation and programming using Python, blending foundational concepts, data structures, and advanced applications, with an emphasis on practical implementation, computational modeling, and data analysis.

Difficulty Level
Beginner
Academic Level
Undergraduate
programming fundamentalspython programmingcomputational thinkingdata structuressoftware development

01 / Reading Guide

Reading Guide

Citation

Guttag, J. V. (2021). Introduction to Computation and Programming Using Python: With Application to Computational Modeling and Understanding Data (3rd ed.). The MIT Press.

Chapter Summary

The book has 26 chapters and a Python 3.8 quick reference. Its first half teaches programming and the basics of algorithms; its second half uses Python to model and interpret data.

Chapters 1–3: Getting Started; Introduction to Python; Some Simple Numerical Programs

The opening chapters present computation as problem solving, distinguish declarative from imperative knowledge, and introduce Python's basic types, operators and control flow. Chapter 3 applies them to simple numerical programs that find answers by exhaustive enumeration, approximation and bisection search.

Chapters 4–7: Functions, Scoping, and Abstraction; Structured Types and Mutability; Recursion and Global Variables; Modules and Files

Functions and scoping are presented as tools of abstraction. The following chapters cover tuples, lists and dictionaries, with attention to mutability, then recursion and global variables, and finally organizing code into modules and reading and writing files.

Chapters 8–10: Testing and Debugging; Exceptions and Assertions; Classes and Object-Oriented Programming

These chapters cover systematic testing and debugging, exception handling and assertions, and then classes and object-oriented programming.

Chapters 11–13: A Simplistic Introduction to Algorithmic Complexity; Some Simple Algorithms and Data Structures; Plotting and More about Classes

Algorithmic complexity is introduced informally, followed by simple algorithms and data structures such as searching and sorting. Chapter 13 combines plotting with further work on classes.

Chapters 14–15: Knapsack and Graph Optimization Problems; Dynamic Programming

Optimization problems are posed as knapsack and graph problems, followed by a chapter on dynamic programming.

Chapters 16–19: Random Walks and More about Data Visualization; Stochastic Programs, Probability, and Distributions; Monte Carlo Simulation; Sampling and Confidence

The second half turns to randomness: random walks and visualization, probability and distributions, Monte Carlo simulation, and sampling with confidence intervals.

Chapters 20–22: Understanding Experimental Data; Randomized Trials and Hypothesis Checking; Lies, Damned Lies, and Statistics

These chapters apply the probability material to interpreting experimental data, checking hypotheses in randomized trials, and recognizing how statistics can mislead.

Chapters 23–26: Exploring Data with Pandas; A Quick Look at Machine Learning; Clustering; Classification Methods

The final chapters use pandas to explore data and then give an introduction to machine learning, including clustering and classification.

Key Concepts

Chapters 1–10

  • Declarative and imperative knowledge: the book's starting distinction between describing what is true and describing how to compute something.
  • Abstraction and mutability: functions, scoping and structured types are presented as ways of controlling complexity, with mutability as a source of subtle behavior.
  • Testing and exceptions: systematic testing, debugging, exception handling and assertions.

Chapters 11–15

  • Algorithmic complexity: an informal way of reasoning about how running time grows.
  • Dynamic programming: solving optimization problems such as knapsack by reusing the answers to subproblems.

Chapters 16–26

  • Monte Carlo simulation: estimating quantities by repeated random trials.
  • Sampling and confidence: judging how far a sample result can be trusted.
  • Clustering and classification: the two machine-learning tasks covered in the final chapters.

Critical Analysis

Strengths

  • Programming and data analysis in one book. The publisher describes the book as teaching computational problem solving with Python and libraries including numpy, matplotlib, random, pandas and sklearn, together with data-science techniques for modelling and interpreting data.
  • Written for beginners. The publisher says it introduces students with little or no prior programming experience to computational problem solving.
  • A long arc. Algorithms, complexity, simulation, statistics and machine learning appear in the same book, so a single text can support an introductory course that continues into data analysis.
  • Code and errata online. All the code in the book and an errata sheet are available on the MIT Press web page.

Limitations

  • Breadth over depth in the later chapters. Machine learning receives three chapters (a quick look, clustering, classification) and statistics-related material is spread over several chapters, so these parts are introductions.
  • Pace. In 26 chapters the book goes from basic Python syntax to classification methods, so the later topics are introduced briefly; the machine-learning chapter is itself titled a quick look.
  • Python-specific. The treatment of types, mutability and libraries is tied to Python 3.8, and the quick reference at the end is written for that version.

Where It Fits in the Course

Among the introductory programming books in this course, How to Design Programs teaches a systematic design recipe in the DrRacket environment, and Structure and Interpretation of Computer Programs emphasizes abstraction, higher-order procedures and interpreters. Python Crash Course is a practical first book on Python that ends with larger projects; Think Python is a clear, practical introduction to programming and computer science in Python. The C Programming Language is a concise classic for systems-level programming.

Guttag's book is a reasonable second step after one of the gentler introductions, or a first book for readers who are comfortable with mathematics, because it moves from programming into algorithms, simulation and data analysis. Compared with Python Crash Course, it is less project-driven and more about computational thinking; compared with SICP, it uses a mainstream language and has no chapter on building interpreters.

How to Use This Book

The book is aimed at readers with little or no programming experience and works for a first course in computation, especially one that leads toward data analysis. No prior Python is assumed.

Chapters 1–10 are the core for a first course, with Chapters 11–13 on complexity and basic algorithms. Chapters 14–15 are a good optional step for those interested in optimization. Chapters 16–22 suit readers who want simulation and statistics, and Chapters 23–26 are for those who want data handling and machine learning. Type the code in each chapter and run it, and download the code from the MIT Press page to compare with your own versions.