Python Programming in Context. 4 Ed

Python Programming in Context. 4 Ed

Python Programming in Context. 4 Ed
Автор: Anderson Jon, Anderson Julie A.
Дата выхода: 2025
Издательство: Jones & Bartlett Learning
Количество страниц: 1564
Размер файла: 34,1 МБ
Тип файла: PDF
Добавил: codelibs
 Проверить на вирусы

Cover
Title Page
Copyright Page
Dedication Page
Brief Contents
Contents
Preface
Acknowledgments
CHAPTER 1 Introduction to Python
1.1 Objectives
1.2 What Is Computer Science?
1.3 Why Study Computer Science?
1.3.1 Everyday Applications of Computer Science
1.3.2 Why Computer Science Is Important
1.4 Problem-Solving Strategies
1.5 Python Overview
1.5.1 Primitive Elements
1.5.2 Naming Objects
1.5.3 Abstraction
1.5.4 Repetition
1.6 Summary
Key Terms
Programming Exercises
CHAPTER 2 Playing by the Rules
2.1 Objectives
2.2 The Chatbot
2.3 The String Data Type
2.4 Making Decisions
2.4.1 Boolean Expressions
2.4.2 Compound Boolean Expressions and Logical Operators
2.4.3 Selection Statements
2.5 Implementing the Chatbot
2.6 Playing Games
2.6.1 Guess a Number
2.6.2 The while Loop
2.6.3 Printing Numbers in Strings
2.6.4 Asking for Input
2.7 Completing Guess a Number
2.8 Validating User Input
2.9 Counting the Guesses
2.9.1 The Accumulator Pattern
2.10 The Game of Nim
2.10.1 Random Numbers
2.10.2 Returning a Value from a Function
2.11 Summary
Key Terms
Programming Exercises
CHAPTER 3 Codes and Other Secrets
3.1 Objectives
3.2 The String Data Type
3.2.1 Repetition
3.2.2 Indexing
3.2.3 String Slicing
3.2.4 String Searching
3.2.5 String Methods
3.2.6 Character Functions
3.3 Encrypting and Decrypting Messages
3.4 Transposition Cipher
3.4.1 Encrypting Using Transposition
3.4.2 Decrypting a Transposed Message
3.5 Substitution Cipher
3.6 Creating a Key
3.7 The Vigenère Cipher
3.8 Summary
Key Terms
Programming Exercises
CHAPTER 4 Introducing the Python Collections
4.1 Objectives
4.2 What Is Data?
4.3 Storing Data for Processing
4.3.1 Strings Revisited
4.3.2 Lists
4.4 Calculating Statistics on Data
4.4.1 Simple Dispersion
4.5 Central Tendency
4.5.1 Mean
4.5.2 Median
4.5.3 Mode
4.6 Frequency Distribution
4.6.1 Using a Dictionary to Compute a Frequency Table
4.6.2 Computing a Frequency Table Without a Dictionary
4.6.3 Visualizing a Frequency Distribution
4.7 Dispersion: Standard Deviation
4.8 Summary
Key Terms
Programming Exercises
CHAPTER 5 Bigger Data: File I/O
5.1 Objectives
5.2 Using Files for Large Data Sets
5.2.1 Text Files
5.2.2 Iterating over Lines in a File
5.2.3 Writing a File
5.2.4 String Formatting
5.2.5 Alternative File-Reading Methods
5.3 Reading Data from the Internet
5.3.1 Using CSV Files
5.3.2 Using a while Loop to Read a File
5.3.3 List Comprehension
5.4 Reading and Manipulating Data with pandas
5.4.1 pandas Data Structures
5.4.2 Reading CSV Data with pandas
5.4.3 Data Manipulation with pandas
5.5 Reading JSON Data from the Internet
5.6 Correlating Data
5.7 Summary
Key Terms
Programming Exercise
CHAPTER 6 Image Processing
6.1 Objectives
6.2 What Is Digital Image Processing?
6.2.1 The RGB Color Model
6.2.2 The cImage Module
6.3 Basic Image Processing
6.3.1 Negative Images
6.3.2 Grayscale
6.3.3 A General Solution: The Pixel Mapper
6.4 Parameters, Parameter Passing, and Scope
6.4.1 Call by Assignment Parameter Passing
6.4.2 Namespaces
6.4.3 Calling Functions and Finding Names
6.4.4 Modules and Namespaces
6.5 Advanced Image Processing
6.5.1 Resizing
6.5.2 Stretching: A Different Perspective
6.5.3 Flipping an Image
6.5.4 Edge Detection
6.6 Summary
Key Terms
Programming Exercises
CHAPTER 7 Data Mining: Cluster Analysis
7.1 Objectives
7.2 What Is Data Mining?
7.3 Cluster Analysis: A Simple Example
7.4 Implementing Cluster Analysis on Simple Data
7.4.1 Distance Between Two Points
7.4.2 Clusters and Centroids
7.4.3 The K-Means Cluster Analysis Algorithm
7.4.4 Implementation of K-Means
7.4.5 Implementation of K-Means, Continued
7.5 Implementing Cluster Analysis: Earthquakes
7.5.1 File Processing
7.5.2 Visualization
7.6 Cluster Analysis Shortcomings and Solutions
7.7 Summary
Key Terms
Programming Exercises
CHAPTER 8 Cryptanalysis
8.1 Objectives
8.2 Introduction
8.3 Cracking the Rail Fence
8.3.1 Checking Our Work with a Dictionary
8.3.2 A Brute-Force Solution
8.3.3 A Rail Fence Decryption Algorithm
8.4 Cracking the Substitution Cipher
8.4.1 Letter Frequency
8.4.2 Ciphertext Frequency Analysis
8.4.3 Letter Pair Analysis
8.4.4 Word Frequency Analysis
8.4.5 Pattern Matching with Partial Words
8.4.6 Regular Expression Summary
8.5 Summary
Key Terms
Programming Exercises
CHAPTER 9 Fractals: The Geometry of Nature
9.1 Objectives
9.2 Introduction
9.3 Recursive Programs
9.3.1 Recursive Squares
9.3.2 Classic Recursive Functions
9.3.3 Drawing a Recursive Tree
9.3.4 The Sierpinski Triangle
9.3.5 Call Tree for a Sierpinski Triangle
9.4 Snowflakes, Lindenmayer, and Grammars
9.4.1 L-Systems and the match Statement
9.4.2 Automatically Expanding Production Rules
9.4.3 More Advanced L-Systems
9.5 Summary
Key Terms
Programming Exercises
CHAPTER 10 Planet Objects
10.1 Objectives
10.2 Introduction
10.2.1 Focusing on Data
10.2.2 Object-Oriented Programming
10.2.3 Python Classes
10.3 Designing and Implementing a Planet Class
10.3.1 Constructor Method
10.3.2 Accessor Methods
10.3.3 Mutator Methods
10.3.4 Special Methods
10.3.5 Methods and self
10.3.6 Details of Method Storage and Lookup
10.4 Designing and Implementing a Sun Class
10.5 Designing and Implementing a Solar System
10.6 Animating the Solar System
10.6.1 Using Turtles
10.6.2 Planetary Orbits
10.6.3 Implementing the Simulation
10.7 Summary
Key Terms
Programming Exercises
CHAPTER 11 Simulation
11.1 Objectives
11.2 Bears and Fish
11.3 What Is a Simulation?
11.4 Rules of the Game
11.5 Design
11.6 Implementation
11.6.1 The World Class
11.6.2 The Fish Class
11.6.3 The Bear Class
11.6.4 Main Simulation
11.7 Growing Plants
11.8 A Note on Inheritance
11.9 Summary
Key Terms
Programming Exercises
CHAPTER 12 A Hierarchy of Shapes
12.1 Objectives
12.2 Introduction
12.3 First Design
12.4 Basic Implementation
12.4.1 The Canvas Class
12.4.2 The GeometricObject Class
12.4.3 The Point Class
12.4.4 The Line Class
12.4.5 Testing Our Implementation
12.5 Understanding Inheritance
12.6 Limitations
12.7 An Improved Implementation
12.8 Implementing Polygons
12.9 Summary
Key Terms
Programming Exercises
CHAPTER 13 Interactive Games
13.1 Objectives
13.2 Introduction
13.2.1 Event-Driven Programming
13.2.2 Simulating an Event Loop
13.2.3 A Multithreaded Event Loop
13.3 Event-Driven Programming with the Turtle
13.3.1 A Simple Drawing Using Key Presses
13.3.2 Placing Turtles Using Mouse Clicks
13.3.3 Bouncing Turtles
13.4 Creating Your Own Video Game
13.4.1 The LaserCannon Class
13.4.2 The BoundedTurtle Class
13.4.3 The Drone Class
13.4.4 The Bomb Class
13.4.5 Putting All the Pieces Together
13.5 Summary
Key Terms
Programming Exercises
Appendix A: Installing the Required Software
A.1 Installing Python
A.2 Installing the Jupyter Notebook IDE
A.3 Installing the Matplotlib and pandas Libraries
A.4 Installing the Python Image Library and cImage
Appendix B: Python Quick Reference
B.1 Python Reserved Words
B.2 Numeric Data Types
B.3 Built-in Functions
B.4 Sequence Operators
B.5 Dictionaries
B.6 Files
B.7 Formatting Output
B.8 Iteration
B.9 Boolean Expressions
B.10 Selection
B.11 Python Modules
B.12 Regular Expression Patterns
B.13 Syntax for Defining a Function
B.14 Syntax for Defining a Class
B.15 Deleting Objects
B.16 matplotlib
B.17 pandas
B.18 Common Error Messages
Appendix C: turtle Reference
C.1 Basic Move and Draw
C.2 Turtle State
C.3 Drawing State
C.4 Filling
C.5 More Drawing Control
C.6 Controlling the Shape and Appearance
C.7 Measurement Settings
C.8 Drawing Speed
C.9 Color
C.10 Events
C.11 Miscellaneous
Appendix D: Answers to Selected Try It Out Exercises
Chapter 1
Chapter 2
Chapter 3
Chapter 4
Chapter 5
Chapter 6
Chapter 7
Chapter 8
Chapter 9
Chapter 10
Chapter 11
Chapter 12
Chapter 13
Glossary
Index

Python Programming in Context, Fourth Edition provides a comprehensive and accessible introduction to Python fundamentals. Updated with Python 3.10, the Fourth Edition offers a thorough overview of multiple applied areas, including image processing, cryptography, astronomy, the Internet, and bioinformatics. Taking an active learning approach, each chapter starts with a comprehensive real-world project that teaches core design techniques and Python programming to immediately engage students. An ideal first language for learners entering the rapidly expanding fields of computer science, data science, and scientific programing, Python gives students a solid platform of key problem-solving skills that translate easily across programming languages. This text is designed to be a first course in computer science that focuses on problem-solving, with language features being introduced as needed to solve the problem at hand.The Fourth Edition's emphasis on problem-solving, extrapolation, and the development of independent exploration and solution-building provides students with a unique and innovative approach to learning programming. While students solve problems of general interest, language elements are introduced with deliberate and incremental exposure to the fundamentals. Python Programming in Context, Fourth Edition is the ideal introductory text for those learning the Python language. Interested in seeing what Professor Brahima Mbodje, Director of Cybersecurity Programs at Clinton College, had to say about this textbook? Check out his review of the Fourth Edition here. Completely UPDATED with the most up-to-date version of Python 3.10"Good Programming Practice" boxes that provide problem-solving strategies, as well as tips for writing readable and maintainable code."Recap" boxes summarize important concepts."Heads Up" boxes alert students to possible pitfalls, and provide techniques for avoiding errors.Python code is color-coded so students can better see syntax elements.Available to be bundled with Cloud Desktop for Python Programming, an on-demand virtual Windows workstation for students to learn programming using either the practice exercises in the textbook or projects assigned by the instructor.All sessions and listings in the book have been written using the popular and freely available Jupyter Notebook.Instructor Resources include answers to chapter exercises, a test bank, and lecture outlines in PowerPoint format.


Похожее:

Список отзывов:

Нет отзывов к книге.