Table of Contents

1.1 Programming (general)
1.2 Programming using Python
1.3 Basic input and output
1.4 Errors
1.5 Development environment
1.6 Computers and programs (general)
1.7 Computer tour
1.8 Language history
1.9 Why whitespace matters
1.10 Python example: Salary calculation
1.11 Additional practice: Output art

2.1 Variables and assignments
2.2 Identifiers
2.3 Objects
2.4 Numeric types: Floating-point
2.5 Arithmetic expressions
2.6 Python expressions
2.7 Division and modulo
2.8 Module basics
2.9 Math module
2.10 Random numbers
2.11 Representing text
2.12 Additional practice: Number games

3.1 String basics
3.2 String formatting
3.2 List basics
3.3 Tuple basics
3.4 Set basics
3.5 Dictionary basics
3.6 Common data types summary
3.7 Additional practice: Grade calculation
3.8 Type conversions
3.9 Binary numbers
3.11 Additional practice: Health data

4.1 If-else branches (general)
4.2 Detecting equal values with branches
4.3 Detecting ranges with branches (general)
4.4 Detecting ranges with branches
4.5 Detecting ranges using logical operators
4.6 Detecting ranges with gaps
4.7 Detecting multiple features with branches
4.8 Comparing data types and common errors
4.9 Membership and identity operators
4.10 Order of evaluation
4.11 Code blocks and indentation
4.12 Conditional expressions
4.13 Additional practice: Tweet decoder

5.1 Loops (general)
5.2 While loops
5.3 More while examples
5.4 Counting
5.5 For loops
5.6 Counting using the range() function
5.7 While vs. for loops
5.8 Nested loops
5.9 Developing programs incrementally
5.10 Break and continue
5.11 Loop else
5.12 Getting both index and value when looping: enumerate()
5.13 Additional practice: Dice statistics

6.1 User-defined function basics
6.2 Print functions
6.3 Dynamic typing
6.4 Reasons for defining functions
6.5 Writing mathematical functions
6.6 Function stubs
6.7 Functions with branches/loops
6.8 Functions are objects
6.9 Functions: Common errors
6.10 Scope of variables and functions
6.11 Namespaces and scope resolution
6.12 Function arguments
6.13 Keyword arguments and default parameter values
6.14 Arbitrary argument lists
6.15 Multiple function outputs
6.16 Help! Using docstrings to document functions
6.17 Engineering examples

7.1 String slicing
7.2 Advanced string formatting
7.3 String methods
7.4 Splitting and joining strings

8.1 Lists
8.2 List methods
8.3 Iterating over a list
8.4 List games
8.5 List nesting
8.6 List slicing
8.7 Loops modifying lists
8.8 List comprehensions
8.9 Sorting lists
8.10 Command-line arguments
8.11 Additional practice: Engineering examples
8.12 Dictionaries
8.13 Dictionary methods
8.14 Iterating over a dictionary
8.15 Dictionary nesting

9.1 Classes: Introduction
9.2 Classes: Grouping data
9.3 Instance methods
9.4 Class and instance object types
9.5 Class example: Seat reservation system
9.6 Class constructors
9.7 Class interfaces
9.8 Class customization
9.9 More operator overloading: Classes as numeric types
9.10 Memory allocation and garbage collection

10.1 Handling exceptions using try and except
10.2 Multiple exception handlers
10.3 Raising exceptions
10.4 Exceptions with functions
10.5 Using finally to clean up
10.6 Custom exception types

11.1 Modules
11.2 Finding modules
11.3 Importing specific names from a module
11.4 Executing modules as scripts
11.5 Reloading modules
11.6 Packages
11.7 Standard library

12.1 Reading files
12.2 Writing files
12.3 Interacting with file systems
12.4 Binary data
12.5 Command-line arguments and files
12.6 The ‘with’ statement
12.7 Comma separated values files

13.1 Derived classes
13.2 Accessing base class attributes
13.3 Overriding class methods
13.4 Is-a versus has-a relationships
13.5 Mixin classes and multiple inheritance
13.6 Testing your code: The unittest module

14.1 Recursive functions
14.2 Recursive algorithm: Search
14.3 Adding output statements for debugging
14.4 Creating a recursive function
14.5 Recursive math functions
14.6 Recursive exploration of all possibilities

15.1 Introduction to data science
15.2 Data science life cycle
15.3 Introduction to Python for data science
15.4 Introduction to Jupyter Notebooks
15.5 NumPy
15.6 pandas
15.7 Matplotlib

16.1 Searching and algorithms
16.2 Binary search
16.3 O notation
16.4 Algorithm analysis
16.5 Sorting: Introduction
16.6 Selection sort
16.7 Insertion sort
16.8 Quicksort
16.9 Merge sort

17.1 String formatting using %
17.2 String formatting using format()
17.3 String formatting using dictionaries
17.4 Basic graphics
17.5 zyBooks built-in programming window

Teach Python with this hands-on, interactive zyBook, now updated with advanced zyLabs

Programming in Python 3 is a comprehensive introduction to the principles and practice of Python programming, based on the latest standards.

  • Covers foundational constructs, like branches, loops, and functions, and advanced topics, like inheritance, exceptions, and plotting
  • Packed with over 600 interactive coding exercises and learning activities to help students master the material
  • Customizable so instructors can reorganize, edit, and add their own learning content
  • Updated with an in-depth chapter on using Python for data science, complete with Jupyter Notebook integration
  • Adopters have access to a test bank with over 500 questions

What is a zyBook?

Programming with Python 3 is a web-native, interactive zyBook that helps students visualize concepts to learn faster and more effectively than with a traditional textbook. (Check out our research.)

Since 2012, over 1,700 academic institutions have adopted digital zyBooks to transform their STEM education.

zyBooks benefits both students and instructors:

  • Instructor benefits
  • Customize your course by reorganizing existing content, or adding your own content
  • Continuous publication model updates your course with the latest content and technologies
  • Robust reporting gives you insight into students’ progress, reading and participation
  • Save time with auto-graded labs and challenge activities that seamlessly integrate with your LMS gradebook
  • Build quizzes and exams with over 580 included test questions
  • Student benefits
  • Learning questions and other content serve as an interactive form of reading
  • Instant feedback on labs and homework
  • Concepts come to life through extensive animations embedded into the interactive content
  • Review learning content before exams with different questions and challenge activities
  • Save chapters as PDFs to reference the material at any time

zyBooks programming environment

See the advanced zyLabs capabilities:


Bailey Miller
Computer Science PhD, University of California, Riverside

Instructors: Interested in evaluating this zyBook for your class?

Check out these related zyBooks