

Security policy
Delivery policy
Return policy
This new edition has all the familiar elements that made previous editions a leading intro textbook, including:
The focus of this edition continues to be on providing a solid foundation in computer science appropriate for a first computing course for CS majors (CS1). At the same time, many learners outside of CS are also keen to develop programming skills. All budding programmers are best served by a firm grounding in computer science and software design, so the material here has been streamlined and reorganized to make it more useful as a reference for learners in CS-adjacent fields such as the natural and social sciences, data science, and intelligent systems. Special attention is paid to essential idioms that students are likely to see in Python code that they encounter in the wild. In addition to technology updates throughout, those familiar with the previous edition will notice these changes:
1.1 The Universal Machine
1.2 Program Power
1.3 What Is Computer Science?
1.4 Hardware Basics
1.5 Operating Systems
1.6 Programming Languages
1.7 The Magic of Python
1.8 Inside a Python Program
1.9 Chaos and Computers
1.10 Chapter Summary
1.11 Exercises
2.1 The Software Development Process
2.2 Example Program: Temperature Converter
2.3 Elements of Programs
2.3.1 Names
2.3.2 Expressions
2.4 Output Statements
2.5 Assignment Statements
2.5.1 Simple Assignment
2.5.2 Assigning Input
2.5.3 Simultaneous Assignment
2.6 Definite Loops
2.7 Example Program: Future Value
2.8 Chapter Summary
2.9 Exercises
3.1 Numeric Data Types
3.2 Type Conversions and Rounding
3.2.1 Numeric Type Conversions
3.2.2 Converting Between Numbers and Strings
3.3 Using the Math Library
3.4 Accumulating Results: Factorials
3.5 Limitations of Computer Arithmetic
3.6 Chapter Summary
3.7 Exercises
4.1 Overview
4.2 The Object of Objects
4.3 Simple Graphics Programming
4.4 Using Graphical Objects
4.5 Graphing Future Value
4.5.1 Basic Design
4.5.2 Choosing Coordinates
4.5.3 Writing the Program
4.6 Interactive Graphics
4.6.1 Getting Mouse Clicks
4.6.2 Handling Textual Input
4.7 Graphics Module Reference
4.7.1 GraphWin Objects
4.7.2 Graphics Objects
4.7.3 Entry Objects
4.7.4 Displaying Images
4.7.5 Generating Colors
4.7.6 Controlling Display Updates (Advanced)
4.8 Chapter Summary
4.9 Exercises
5.1 The Function of Functions
5.2 Functions, Informally
5.3 Future Value with a Function
5.4 Functions and Parameters: The Exciting Details
5.5 Functions That Return Values
5.6 Functions That Modify Parameters
5.7 Functions and Program Structure
5.8 Chapter Summary
5.9 Exercises
6.1 Simple Decisions
6.1.1 Example: Temperature Warnings
6.1.2 Forming Simple Conditions
6.1.3 Example: Conditional Program Execution
6.2 Two-Way Decisions
6.3 Multi-Way Decisions
6.4 Exception Handling
6.5 Study in Design: Max of Three
6.5.1 Strategy 1: Compare Each to All
6.5.2 Strategy 2: Decision Tree
6.5.3 Strategy 3: Sequential Processing
6.5.4 Strategy 4: Use Python
6.5.5 Some Lessons
6.6 Chapter Summary
6.7 Exercises
7.1 For Loops: A Quick Review
7.2 Indefinite Loops
7.3 Common Loop Patterns
7.3.1 Interactive Loops
7.3.2 Sentinel Loops
7.4 Computing with Booleans
7.4.1 Boolean Operators
7.4.2 Boolean Algebra
7.5 Other Common Structures
7.5.1 Post-Test Loop
7.5.2 Loop and a Half
7.5.3 Boolean Expressions as Decisions
7.6 Example: A Simple Event Loop
7.7 Chapter Summary
7.8 Exercises
8.1 The String Data Type
8.2 Simple String Processing
8.3 String Representation and Message Encoding
8.3.1 String Representation
8.3.2 Programming an Encoder
8.4 String Methods
8.4.1 Programming a Decoder
8.4.2 From Encoding to Encryption
8.5 More String Methods
8.6 String Formatting
8.6.1 Using f-strings
8.6.2 Better Change Counter
8.7 Chapter Summary
8.8 Exercises
9.1 Example Problem: Simple Statistics
9.2 Python Lists
9.2.1 Lists and Arrays as Sequences
9.2.2 List Operations
9.2.3 List Methods
9.3 Statistics with Lists
9.4 Pythonic List Manipulation
9.5 Other Data Structures
9.5.1 Tuples
9.5.2 Dictionaries (Optional)
9.6 Chapter Summary
9.7 Exercises
10.1 Text Files
10.1.1 Multi-line Strings
10.1.2 File-Processing Outline
10.1.3 Reading from a File
10.1.4 Writing to a File
10.1.5 Batch Processing
10.2 File Names and Paths
10.2.1 Absolute and Relative Paths
10.2.2 Using pathlib
10.2.3 Iterating Over Directories
10.2.4 File Dialogs (Optional)
10.3 Binary Files and Pickling
10.3.1 Strings and Bytes
10.3.2 Binary Mode and Pickling (Optional)
10.4 Remote Files (Optional)
10.5 Chapter Summary
10.6 Exercises
11.1 Simulating Racquetball
11.1.1 A Simulation Problem
11.1.2 Analysis and Specification
11.2 Pseudo-Random Numbers
11.3 Top-Down Design
11.3.1 Top-Level Design
11.3.2 Separation of Concerns
11.3.3 Second-Level Design
11.3.4 Designing simNGames
11.3.5 Third-Level Design
11.3.6 Finishing Up
11.3.7 Summary of the Design Process
11.4 Bottom-Up Implementation
11.4.1 Unit Testing
11.4.2 Simulation Results
11.5 Other Design Techniques
11.5.1 Prototyping and Spiral Development
11.5.2 The Art of Design
11.6 Chapter Summary
11.7 Exercises
12.1 Quick Review of Objects
12.2 Example Program: Cannonball
12.2.1 Program Specification
12.2.2 Designing the Program
12.2.3 Modularizing the Program
12.3 Defining New Classes
12.3.1 Example: Multi-Sided Dice
12.3.2 Example: The Projectile Class
12.4 Data Processing with Class
12.4.1 Student as Object
12.4.2 Lists of Objects
12.5 Objects and Encapsulation
12.5.1 Encapsulating Useful Abstractions
12.5.2 Putting Classes in Modules
12.5.3 Module Documentation
12.5.4 Working with Multiple Modules
12.6 Widgets
12.6.1 Example Program: Dice Roller
12.6.2 Building Buttons
12.6.3 Building Dice
12.6.4 The Main Program
12.6.5 Application as a Class
12.7 Chapter Summary
12.8 Exercises
13.1 The Process of OOD
13.2 Case Study: Racquetball Simulation
13.2.1 Candidate Objects and Methods
13.2.2 Implementing SimStats
13.2.3 Implementing RBallGame
13.2.4 Implementing Player
13.2.5 The Complete Program
13.3 Case Study: Cannonball Animation
13.3.1 Creating an Animation Window
13.3.2 Creating a ShotTracker
13.3.3 Creating an Input Dialog
13.3.4 The Main Event Loop
13.3.5 Creating a Launcher
13.3.6 Tracking Multiple Shots
13.3.7 Final Structure
13.4 Case Study: Dice Poker
13.4.1 Program Specification
13.4.2 Identifying Candidate Objects
13.4.3 Implementing the Model
13.4.4 A Text-Based UI
13.4.5 Developing a GUI
13.5 OO Concepts
13.5.1 Encapsulation
13.5.2 Polymorphism
13.5.3 Inheritance
13.6 Chapter Summary
13.7 Exercises
14.1 Searching
14.1.1 A Simple Searching Problem
14.1.2 Strategy 1: Linear Search
14.1.3 Strategy 2: Binary Search
14.1.4 Comparing Algorithms
14.2 Recursive Problem Solving
14.2.1 Recursive Definitions
14.2.2 Recursive Functions
14.2.3 Example: String Reversal
14.2.4 Example: Anagrams
14.2.5 Example: Fast Exponentiation
14.2.6 Example: Binary Search
14.2.7 Recursion vs. Iteration
14.3 Sorting Algorithms
14.3.1 Naive Sorting: Selection Sort
14.3.2 Divide and Conquer: Merge Sort
14.3.3 Comparing Sorts
14.4 Hard Problems
14.4.1 Tower of Hanoi
14.4.2 The Halting Problem
14.4.3 Conclusion
14.5 Chapter Summary
14.6 Exercises