Building Python Programs, 1st edition

Published by Pearson (August 3, 2018) © 2019

  • Stuart Reges University of Washington
  • Marty Stepp Stanford University
  • Allison Obourn

eTextbook

per month

  • Anytime, anywhere learning with the Pearson+ app
  • Easy-to-use search, navigation and notebook
  • Simpler studying with flashcards
from$95.99

  • Hardcover, paperback or looseleaf edition
  • Affordable rental option for select titles
  • Free shipping on looseleafs and traditional textbooks

For courses in Python programming.

A layered, back-to-basics approach to Python programming

Building Python Programs, written by the authors of the long successful Building Java Programs, brings a proven, class-tested and back-to-basics strategy to teaching Python programming. The authors' signature layered approach introduces programming fundamentals first, with new syntax and concepts added over multiple chapters. Object-oriented programming is discussed only after students have developed a basic understanding of Python programming.

The text focuses on problem-solving with an emphasis on algorithmic thinking and is appropriate for the 2-semester sequence in introductory computer science.

Hallmark features of this title

  • The authors' uniquely layered approach teaches students new concepts gradually, layer by layer, allowing students to expand their understanding at a manageable pace.
  • The focus on problem-solving ensures students are thinking about what new problems can be solved, what are the common ways to use, and what pitfalls they're likely to encounter with each new construct.
  • An emphasis on algorithmic thinking guides students in breaking a large problem into smaller problems, using pseudocode to refine an algorithm, and grappling with the challenge of expressing a large program algorithmically.
  • Case studies at the end of most chapters teach students how to develop a complex program in stages and how to test each program as it is being developed.

Chapter 1 Introduction to Python Programming

  • 1.1 Basic Computing Concepts
    • Why Programming?
    • Hardware and Software
    • The Digital Realm
    • The Process of Programming
    • Why Python?
    • The Python Programming Environment
  • 1.2 And Now: Python
    • Printing Output
    • String Literals (Strings)
    • Escape Sequences
    • Printing a Complex Figure
    • Comments, Whitespace, and Readability
  • 1.3 Program Errors
    • Syntax Errors
    • Logic Errors (Bugs)
  • 1.4 Procedural Decomposition
    • Functions
    • Flow of Control
    • Identifiers and Keywords
    • Functions That Call Other Functions
    • An Example Runtime Error
  • 1.5 Case Study: Drawing Figures
    • Structured Version
    • Final Version without Redundancy
    • Analysis of Flow of Execution

Chapter 2 Data and Definite Loops

  • 2.1 Basic Data Concepts
    • Types
    • Expressions
    • Literals
    • Arithmetic Operators
    • Precedence
    • Mixing and Converting Types
  • 2.2 Variables
    • A Program with Variables
    • Increment/Decrement Operators
    • Printing Multiple Values
  • 2.3 The for Loop
    • Using a Loop Variable
    • Details about Ranges
    • String Multiplication and Printing Partial Lines
    • Nested for Loops
  • 2.4 Managing Complexity
    • Scope
    • Pseudocode
    • Constants
  • 2.5 Case Study: Hourglass Figure
    • Problem Decomposition and Pseudocode
    • Initial Structured Version
    • Adding a Constant

Chapter 3 Parameters and Graphics

  • 3.1 Parameters
    • The Mechanics of Parameters
    • Limitations of Parameters
    • Multiple Parameters
    • Parameters versus Constants
    • Optional Parameters
  • 3.2 Returning Values
    • The math Module
    • The random Module
    • Defining Functions That Return Values
    • Returning Multiple Values
  • 3.3 Interactive Programs
    • Sample Interactive Program
  • 3.4 Graphics
    • Introduction to DrawingPanel
    • Drawing Lines and Shapes
    • Colors
    • Drawing with Loops
    • Text and Fonts
    • Images
    • Procedural Decomposition with Graphics
  • 3.5 Case Study: Projectile Trajectory
    • Unstructured Solution
    • Structured Solution
    • Graphical Version

Chapter 4 Conditional Execution

  • 4.1 if/else Statements
    • Relational Operators
    • Nested if/else Statements
    • Factoring if/else Statements
    • Testing Multiple Conditions
  • 4.2 Cumulative Algorithms
    • Cumulative Sum
    • Min/Max Loops
    • Cumulative Sum with if
    • Roundoff Errors
  • 4.3 Functions with Conditional Execution
    • Preconditions and Postconditions
    • Raising Exceptions
    • Revisiting Return Values
    • Reasoning about Paths
  • 4.4 Strings
    • String Methods
    • Accessing Characters by Index
    • Converting between Letters and Numbers
    • Cumulative Text Algorithms
  • 4.5 Case Study: Basal Metabolic Rate
    • One-Person Unstructured Solution
    • Two-Person Unstructured Solution
    • Two-Person Structured Solution
    • Procedural Design Heuristics

Chapter 5 Program Logic and Indefinite Loops

  • 5.1 The while Loop
    • A Loop to Find the Smallest Divisor
    • Loop Priming
  • 5.2 Fencepost Algorithms
    • Fencepost with if
    • Sentinel Loops
    • Sentinel with Min/Max
  • 5.3 Boolean Logic
    • Logical Operators
    • Boolean Variables and Flags
    • Predicate Functions
    • Boolean Zen
    • Short-Circuited Evaluation
  • 5.4 Robust Programs
    • The try/except Statement
    • Handling User Errors
  • 5.5 Assertions and Program Logic
    • Reasoning about Assertions
    • A Detailed Assertions Example
  • 5.6 Case Study: Number Guessing Game
    • Initial Version without Hinting
    • Randomized Version with Hinting
    • Final Robust Version

Chapter 6 File Processing

  • 6.1 File-Reading Basics
    • Data and Files
    • Reading a File in Python
    • Line-Based File Processing
    • Structure of Files and Consuming Input
    • Prompting for a File
  • 6.2 Token-Based Processing
    • Numeric Input
    • Handling Invalid Input
    • Mixing Lines and Tokens
    • Handling Varying Numbers of Tokens
    • Complex Input Files
  • 6.3 Advanced File Processing
    • Multi-Line Input Records
    • File Output
    • Reading Data from the Web
  • 6.4 Case Study: ZIP Code Lookup

Chapter 7 Lists

  • 7.1 List Basics
    • Creating Lists
    • Accessing List Elements
    • Traversing a List
    • A Complete List Program
    • Random Access
    • List Methods
  • 7.2 List-Traversal Algorithms
    • Lists as Parameters
    • Searching a List
    • Replacing and Removing Values
    • Reversing a List
    • Shifting Values in a List
    • Nested Loop Algorithms
    • List Comprehensions
  • 7.3 Reference Semantics
    • Values and References
    • Modifying a List Parameter
    • The Value None
    • Mutability
    • Tuples
  • 7.4 Multidimensional Lists
    • Rectangular Lists
    • Jagged Lists
    • Lists of Pixels
  • 7.5 Case Study: Benford’s Law
    • Tallying Values
    • Completing the Program

Chapter 8 Dictionaries and Sets

  • 8.1 Dictionary Basics
    • Creating a Dictionary
    • Dictionary Operations
    • Looping Over a Dictionary
    • Dictionary Ordering
  • 8.2 Advanced Dictionary Usage
    • Dictionary for Tallying
    • Nested Collections
    • Dictionary Comprehensions
  • 8.3 Sets
    • Set Basics
    • Set Operations
    • Set Efficiency
    • Set Example: Lottery

Chapter 9 Recursion

  • 9.1 Thinking Recursively
    • A Nonprogramming Example
    • Iteration to Recursion
    • Structure of Recursive Solutions
    • Reversing a File
    • The Recursive Call Stack
  • 9.2 Recursive Functions and Data
    • Integer Exponentiation
    • Greatest Common Divisor
    • Directory Crawler
  • 9.3 Recursive Graphics
    • Cantor Set
    • Sierpinski Triangle
  • 9.4 Recursive Backtracking
    • Traveling North/East
    • Eight Queens Puzzle
    • Stopping after One Solution
  • 9.5 Case Study: Prefix Evaluator
    • Infix, Prefix, and Postfix Notation
    • Evaluating Prefix Expressions
    • Complete Program

Chapter 10 Searching and Sorting

  • 10.1 Searching and Sorting Libraries
    • Binary Search

About our authors

Stuart Reges is a Principal Lecturer in the Paul G. Allen School of Computer Science and Engineering at the University of Washington. He manages the introductory programming classes, participates in the design of undergraduate curricula, and is involved in K to 12 outreach. He held similar positions at Stanford University and the University of Arizona in a career spanning 30 years. In 1985 he won the Dinkelspiel Award for Outstanding Service to Undergraduate Education at Stanford. In 2012 he won the Distinguished Teaching Award, which is the highest award given by UW for teaching.

Allison Obourn holds a position as Senior Lecturer in the Computer Science Department at the University of Arizona. She worked as a Lecturer at the University of Washington Computer Science & Engineering Department prior to moving to the University of Arizona. At both schools, she has specialized in teaching introductory programming and web programming. She holds a master's degree from the University of Washington Computer Science & Engineering Department.

Need help? Get in touch

Pearson+

All in one place. Pearson+ offers instant access to eTextbooks, videos and study tools in one intuitive interface. Students choose how they learn best with enhanced search, audio and flashcards. The Pearson+ app lets them read where life takes them, no wi-fi needed. Students can access Pearson+ through a subscription or their MyLab or Mastering course.

Video
Play
Privacy and cookies
By watching, you agree Pearson can share your viewership data for marketing and analytics for one year, revocable by deleting your cookies.

Pearson eTextbook: What’s on the inside just might surprise you

They say you can’t judge a book by its cover. It’s the same with your students. Meet each one right where they are with an engaging, interactive, personalized learning experience that goes beyond the textbook to fit any schedule, any budget, and any lifestyle.Â