ENGLISH

Python for Everyone

Book information

Publisher
Wiley
Year
2013
ISBN
1118626133, 9781118626139
Language
english
Format
PDF
Filesize
96 MB (100173178 bytes)
Edition
1
Pages
720\724
Time added
2021-08-25 14:04:27

Description

Python for Everyone, 1st Edition is a comprehensive introduction to Python and computer programming, which focuses on the principles of programming, software engineering, and effective learning. It is designed for a one-semester, mixed-major, first course in programming. Nobody supports your desire to teach students good programming skills like Cay Horstmann and Rance Necaise. Active in both the classroom and the software industry, Horstmann and Necaise know that meticulous coding—not shortcuts—is the base upon which great programmers are made. Using an innovative visual design that leads students step-by-step through intricacies of Python programming, Python For Everyone, 1st Edition instills confidence in beginning programmers and confidence leads to success. Title Page Copyright page Preface A Tour of the Book A Walkthrough of the Learning Aids Acknowledgments Table of Contents 1 Introduction 1.1 Computer Programs 1.2 The Anatomy of a Computer 1.3 The Python Programming Language 1.4 Becoming Familiar with Your Programming Environment 1.5 Analyzing Your First Program 1.6 Errors 1.7 Problem Solving: Algorithm Design 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.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 2.3 Problem Solving: First Do It By Hand 2.4 Strings 2.4.1 The String Type 2.4.2 Concatenation and Repetition 2.4.3 Converting Between Numbers and Strings 2.4.4 Strings and Characters 2.4.5 String Methods 2.5 Input and Output 2.5.1 User Input 2.5.2 Numerical Input 2.5.3 Formatted Output 2.6 Graphics: Simple Drawings 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 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 Numbers and Simulations 4.9.1 Generating Random Numbers 4.9.2 Simulating Die Tosses 4.9.3 The Monte Carlo Method 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 Recursive Functions (Optional) 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 by Manipulating 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 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 Reading and Displaying BMP Images 7.4.5 Processing Image 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 8 Sets and Dictionaries 8.1 Sets 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 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 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 Shape Class Hierarchy 10.6.1 The Base Class 10.6.2 Basic Shapes 10.6.3 Groups of Shapes 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 12 Sorting and Searching 12.1 Selection Sort 12.2 Profiling the Selection Sort Algorithm 12.3 Analyzing the Performance of 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 Running Time 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 The Basic Latin and Latin - 1 Subsets of Unicode Appendix B Python Operator Summary Appendix C Python Reserved Word Summary Appendix D The Python Standard Library Built-in Functions Built-in Classes File Input/Output math Module os Module os.path Module random Module sys Module time Module graphics Module Appendix E Binary Numbers and Bit Operations Binary Numbers Two’s Complement Integers Bit and Shift Operations Glossary Index Illustration Credits

Similar books