Python for Everyone

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

With Wiley's Interactive Edition, you get all the benefits of a downloadable, reflowable eBook with added resources to make your study time more effective, including:

- Lambda Expressions, Default & Static Method interfaces
- Embedded Problem Solving Sections & How-To Guides
- Worked Examples & Self-Check Exercises at the end of each chapter
- Progressive Figures that trace code segments using color for easy recognition
- Linked Programming Tips & Common Errors for programming best practices

Cay Horstmann's Python for Everyone, Interactive Edition, 2nd Edition provides a comprehensive and approachable introduction to fundamental programming techniques and design skills, and helps students master basic concepts and become competent coders. The inclusion of advanced chapters makes the text suitable for a 2 or 3-term sequence, or as a comprehensive reference to programming in Python. Major rewrites and an updated visual design make this student-friendly text even more engaging. Filled with realistic programming examples, a great quantity and variety of homework assignments, and lab exercises that build student problem-solving abilities, it is no surprise Python for Everyone is the number one text for early objects in the Python market.

Author(s): Cay S. Horstmann; Rance D. Necaise
Edition: 2
Publisher: Wiley
Year: 2016

Language: English
Pages: 752
Tags: coding, programming, computer science, mathematics, logic, math, maths

Cover
Title Page
Copyright
Preface
New to This Edition
A Tour of the Book
Acknowledgments
A Walkthrough of the Learning Aids
Contents
Chapter 1 Introduction
1.1 Computer Programs
1.2 The Anatomy of a Computer
1.3 The Python Programming Language
Chapter 2 Programming with Numbers and Strings
2.1 Variables
2.1.1 Defining Variables
2.1.2 Number Types
2.1.3 Variable Names
2.1.4 Constants
2.1.5 Comments
2.1.2 Number Types
2.2 Arithmetic
2.2.1 Basic Arithmetic Operations
2.2.2 Powers
2.2.3 Floor Division and Remainder
2.2.4 Calling Functions
2.2.5 Mathematical Functions
Chapter 3 Decisions
3.1 The if Statement
3.2 Relational Operators
3.3 Nested Branches
3.4 Multiple Alternatives
3.5 Problem Solving: Flowcharts
3.6 Problem Solving: Test Cases
3.7 Boolean Variables and Operators
3.8 Analyzing Strings
3.9 Application: Input Validation
Chapter 4 Loops
4.1 The while Loop
4.2 Problem Solving: Hand-Tracing
4.3 Application: Processing Sentinel Values
4.4 Problem Solving: Storyboards
4.5 Common Loop Algorithms
4.5.1 Sum and Average Value
4.5.2 Counting Matches
4.5.3 Prompting Until a Match is Found
4.5.4 Maximum and Minimum
4.5.5 Comparing Adjacent Values
4.6 The for Loop
4.7 Nested Loops
4.8 Processing Strings
4.8.1 Counting Matches
4.8.2 Finding All Matches
4.8.3 Finding the First or Last Match
4.8.4 Validating a String
4.8.5 Building a New String
4.9 Application: Random Numbersand Simulations
4.9.1 Generating Random Numbers
4.9.2 Simulating Die Tosses
4.9.3 The Monte Carlo Method
4.10 Graphics: Digital Image Processing
4.10.1 Filtering Images
4.10.2 Reconfiguring Images
4.11 Problem Solving: Solve a SimplerProblem First
Chapter 5 Functions
5.1 Functions as Black Boxes
5.2 Implementing and Testing Functions
5.2.1 Implementing a Function
5.2.2 Testing a Function
5.2.3 Programs that Contain Functions
5.3 Parameter Passing
5.4 Return Values
5.5 Functions Without Return Values
5.6 Problem Solving: Reusable Functions
5.7 Problem Solving: Stepwise Refinement
5.8 Variable Scope
5.9 Graphics: Building an ImageProcessing Toolkit
5.9.1 Getting Started
5.9.2 Comparing Images
5.9.3 Adjusting Image Brightness
5.9.4 Rotating an Image
5.9.5 Using the Toolkit
5.10 Recursive Functions (Optional)
Chapter 6 Lists
6.1 Basic Properties of Lists
6.1.1 Creating Lists
6.1.2 Accessing List Elements
6.1.3 Traversing Lists
6.1.4 List References
6.2 List Operations
6.2.1 Appending Elements
6.2.2 Inserting an Element
6.2.3 Finding an Element
6.2.4 Removing an Element
6.2.5 Concatenation and Replication
6.2.6 Equality Testing
6.2.7 Sum, Maximum, Minimum, and Sorting
6.2.8 Copying Lists
6.3 Common List Algorithms
6.3.1 Filling
6.3.2 Combining List Elements
6.3.3 Element Separators
6.3.4 Maximum and Minimum
6.3.5 Linear Search
6.3.6 Collecting and Counting Matches
6.3.7 Removing Matches
6.3.8 Swapping Elements
6.3.9 Reading Input
6.4 Using Lists with Functions
6.5 Problem Solving: Adapting Algorithms
6.6 Problem Solving: Discovering Algorithms byManipulating Physical Objects
6.7 Tables
6.7.1 Creating Tables
6.7.2 Accessing Elements
6.7.3 Locating Neighboring Elements
6.7.4 Computing Row and Column Totals
6.7.5 Using Tables with Functions
Chapter 7 Files and Exceptions
7.1 Reading and Writing Text Files
7.1.1 Opening a File
7.1.2 Reading from a File
7.1.3 Writing to a File
7.1.4 A File Processing Example
7.2 Text Input and Output
7.2.1 Iterating over the Lines of a File
7.2.2 Reading Words
7.2.3 Reading Characters
7.2.4 Reading Records
7.3 Command Line Arguments
7.4 Binary Files and Random Access (Optional)
7.4.1 Reading and Writing Binary Files
7.4.2 Random Access
7.4.3 Image Files
7.4.4 Processing BMP Files
7.5 Exception Handling
7.5.1 Raising Exceptions
7.5.2 Handling Exceptions
7.5.3 The finally Clause
7.6 Application: Handling Input Errors
Chapter 8 Sets and Dictionaries
8.1 Sets
8.1.1 Creating and Using Sets
8.1.2 Adding and Removing Elements
8.1.3 Subsets
8.1.4 Set Union, Intersection, and Difference
8.2 Dictionaries
8.2.1 Creating Dictionaries
8.2.2 Accessing Dictionary Values
8.2.3 Adding and Modifying Items
8.2.4 Removing Items
8.2.5 Traversing a Dictionary
8.3 Complex Structures
8.3.1 A Dictionary of Sets
8.3.2 A Dictionary of Lists
Chapter 9 Objects and Classes
9.1 Object-Oriented Programming
9.2 Implementing a Simple Class
9.3 Specifying the Public Interface of a Class
9.4 Designing the Data Representation
9.5 Constructors
9.6 Implementing Methods
9.7 Testing a Class
9.8 Problem Solving: Tracing Objects
9.9 Problem Solving: Patterns for Object Data
9.9.1 Keeping a Total
9.9.2 Counting Events
9.9.3 Collecting Values
9.9.4 Managing Properties of an Object
9.9.5 Modeling Objects with Distinct States
9.9.6 Describing the Position of an Object
9.10 Object References
9.10.1 Shared References
9.10.2 The None Reference
9.10.3 The self Reference
9.10.4 The Lifetime of Objects
9.11 Application: Writing a Fraction Class
9.11.1 Fraction Class Design
9.11.2 The Constructor
9.11.3 Special Methods
9.11.4 Arithmetic Operations
9.11.5 Logical Operations
Chapter 10 Inheritance
10.1 Inheritance Hierarchies
10.2 Implementing Subclasses
10.3 Calling the Superclass Constructor
10.4 Overriding Methods
10.5 Polymorphism
10.6 Application: A Geometric ShapeClass Hierarchy
10.6.1 The Base Class
10.6.2 Basic Shapes
10.6.3 Groups of Shapes
Chapter 11 Recursion
11.1 Triangle Numbers Revisited
11.2 Problem Solving: Thinking Recursively
11.3 Recursive Helper Functions
11.4 The Efficiency of Recursion
11.5 Permutations
11.6 Backtracking
11.7 Mutual Recursion
Chapter 12 Sorting and Searching
12.1 Selection Sort
12.2 Profiling the Selection Sort Algorithm
12.3 Analyzing the Performanceof the Selection Sort Algorithm
12.4 Merge Sort
12.5 Analyzing the Merge Sort Algorithm
12.6 Searching
12.6.1 Linear Search
12.6.2 Binary Search
12.7 Problem Solving: Estimating the RunningTime of an Algorithm
12.7.1 Linear Time
12.7.2 Quadratic Time
12.7.3 The Triangle Pattern
12.7.4 Logarithmic Time
Appendix A Python Operator Summary
Appendix B Python Reserved Word Summary
Appendix C The Python Standard Library
Appendix D The Basic Latin and Latin-1 Subsets of Unicode
Appendix E Binary Numbers and Bit Operations
Binary Numbers
Two’s Complement Integers
Bit and Shift Operations
Appendix F HTML Summary
Glossary
Index
Credits
EULA