Home Page Icon
Home Page
Table of Contents for
Title Page
Close
Title Page
by Julie Anderson, David L. Ranum, Bradley N. Miller
Python Programming in Context, 3rd Edition
Cover
Title Page
Copyright Page
Dedication
Contents
Preface
1 Introduction to Pythona
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
Python Keywords
Programming Exercises
2 πthon: Estimating Pi
2.1 Objectives
2.2 What Is Pi?
2.3 More About the math Module
2.4 The Archimedes Approach
2.4.1 The Python Implementation
2.4.2 Developing a Function to Compute Pi
2.5 Accumulator Approximations
2.5.1 The Accumulator Pattern
2.5.2 Summation of Terms: The Leibniz Formula
2.5.3 Product of Terms: The Wallis Formula
2.6 A Monte Carlo Simulation
2.6.1 Boolean Expressions
2.6.2 Compound Boolean Expressions and Logical Operators
2.6.3 Selection Statements
2.6.4 Completing the Implementation
2.6.5 Adding Graphics
2.7 Summary
Key Terms
Python Keywords, Modules and Commands
Programming Exercises
3 Codes and Other Secrets
3.1 Objectives
3.2 The String Data Type
3.2.1 Concatenation
3.2.2 Repetition
3.2.3 Indexing
3.2.4 String Slicing
3.2.5 String Searching
3.2.6 String Methods
3.2.7 Character Functions
3.3 Encoding and Decoding Messages
3.4 Transposition Cipher
3.4.1 Encrypting Using Transposition
3.4.2 Decrypting a Transposed Message
3.4.3 Asking for Input
3.5 Substitution Cipher
3.6 Creating a Key
3.7 The Vigenère Cipher
3.8 Summary
Key Terms
New Python Keywords, Functions, and Constants
Programming Exercises
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
Python Keywords, Functions, and Methods
Programming Exercises
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 Process Data
5.3.3 List Comprehension
5.3.4 Reading JSON Data from the Internet
5.4 Correlating Data
5.5 Summary
Key Terms
Python Keywords and Functions
Programming Exercise
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
Python Keywords, Functions, and Variables
Programming Exercises
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
Python Keywords
Programming Exercises
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
Python Functions, Methods, and Keywords
Programming Exercises
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
9.4.2 Automatically Expanding Production Rules
9.4.3 More Advanced L-Systems
9.5 Summary
Key Terms
Programming Exercises
10 Planet Objects
10.1 Objectives
10.2 Introduction
10.2.1 Programming
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 Implementation
10.7 Summary
Key Terms
Python Keywords and Functions
Programming Exercises
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
Python Keywords and Functions
Programming Exercises
12 Father Was a Rectangle
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
Python Keywords, Methods, and Decorator
Programming Exercises
13 Video 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 Etch-a-Sketch 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
Python Keywords and Decorator
Programming Exercises
APPENDIX A Installing the Required Software
A.1 Installing Python
A.2 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 Defining Functions
B.14 Defining Classes
B.15 Deleting Objects
B.16 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
INDEX
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
Cover
Next
Next Chapter
Copyright Page
THIRD EDITION
PYTHON
PROGRAMMING IN CONTEXT
BRADLEY N. MILLER, PHD
LUTHER COLLEGE
DAVID L. RANUM, PHD
LUTHER COLLEGE
JULIE ANDERSON
ROLLINS COLLEGE
JONES & BARTLETT
LEARNING
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset