Python for Everyone, EMEA Edition
Häftad, Engelska, 2019
Av Cay S. Horstmann, Rance D. Necaise, Cay S. (San Jose State University) Horstmann, Rance D. (College of William and Mary) Necaise
859 kr
Beställningsvara. Skickas inom 7-10 vardagar
Fri frakt för medlemmar vid köp för minst 249 kr.Python for Everyone, 3rd Edition is an introduction to programming designed to serve a wide range of student interests and abilities, focused on the essentials, and on effective learning. It is suitable for a first course in programming for computer scientists, engineers, and students in other disciplines. This text requires no prior programming experience and only a modest amount of high school algebra. Objects are used where appropriate in early chapters and students start designing and implementing their own classes in Chapter 9. New to this edition are examples and exercises that focus on various aspects of data science.
Produktinformation
- Utgivningsdatum2019-08-20
- Mått10 x 10 x 10 mm
- Vikt454 g
- FormatHäftad
- SpråkEngelska
- Antal sidor752
- Upplaga3
- FörlagJohn Wiley & Sons Inc
- ISBN9781119638292
Tillhör följande kategorier
- Preface iiiSpecial Features xviii1 Introduction 11.1 Computer Programs 21.2 The Anatomy of a Computer 3CS1 Computers Are Everywhere 51.3 The Python Programming Language 51.4 Becoming Familiar with Your Programming Environment 6PT1 Interactive Mode 8PT2 Backup Copies 9ST1 The Python Interpreter 101.5 Analyzing Your First Program 111.6 Errors 13CE1 Misspelling Words 141.7 PROBLEM SOLVING: Algorithm Design 15CS2 Data Is Everywhere 17HT1 Describing an Algorithm with Pseudocode 18WE1 Writing an Algorithm for Tiling a Floor 202 Programming with Numbers and Strings 232.1 Variables 24Defining Variables 24Number Types 26Variable Names 27Constants 28Comments 29CE1 Using Undefined Variables 30Pt1 Choose Descriptive Variable Names 30PT2 Do Not Use Magic Numbers 302.2 Arithmetic 31Basic Arithmetic Operations 31Powers 32Floor Division and Remainder 32Calling Functions 33Mathematical Functions 35CE2 Roundoff Errors 36CE3 Unbalanced Parentheses 37PT3 Use Spaces in Expressions 37ST1 Other Ways to Import Modules 38ST2 Combining Assignment and Arithmetic 38ST3 Line Joining 382.3 PROBLEM SOLVING: First Do It By Hand 39WE1 Computing Travel Time 402.4 Strings 41The String Type 41Concatenation and Repetition 42Converting Between Numbers and Strings 43Strings and Characters 44String Methods 45ST4 Character Values 46ST5 Escape Sequences 47CS1 International Alphabets and Unicode 472.5 Input and Output 48User Input 48Numerical Input 49Formatted Output 50PT4 Don’t Wait to Convert 53HT1 Writing Simple Programs 53WE2 Computing the Cost of Stamps 56CS2 Bugs in Silicon 582.6 GRAPHICS: Simple Drawings 58Creating a Window 59Lines and Polygons 60Filled Shapes and Color 62Ovals, Circles, and Text 64HT2 GRAPHICS: Drawing Graphical Shapes 65TOOLBOX 1 Symbolic Processing with SymPy 683 Decisions 733.1 The if Statement 74CE1 Tabs 77PT1 Avoid Duplication in Branches 78ST1 Conditional Expressions 783.2 Relational Operators 79CE2 Exact Comparison of Floating-Point Numbers 82ST2 Lexicographic Ordering of Strings 82HT1 Implementing an if Statement 83WE1 Extracting the Middle 853.3 Nested Branches 87PT2 Hand-Tracing 89CS1 Dysfunctional Computerized Systems 903.4 Multiple Alternatives 91TOOLBOX 1 Sending E-mail 933.5 PROBLEM SOLVING: Flowcharts 963.6 PROBLEM SOLVING: Test Cases 99PT3 Make a Schedule and Make Time for Unexpected Problems 1003.7 Boolean Variables and Operators 101CE3 Confusing and and or Conditions 104PT4 Readability 104ST3 Chaining Relational Operators 105ST4 Short-Circuit Evaluation of Boolean Operators 105ST5 De Morgan’s Law 1063.8 Analyzing Strings 1063.9 APPLICATION: Input Validation 110ST6 Terminating a Program 112ST7 Interactive Graphical Programs 112CS2 Artificial Intelligence 113WE2 GRAPHICS: Intersecting Circles 113TOOLBOX 2 Plotting Simple Graphs 1174 Loops 1254.1 The while Loop 126CE1 Don’t Think “Are We There Yet?” 130CE2 Infinite Loops 130CE3 Off-by-One Errors 131ST1 Special Form of the print Function 132CS1 The First Bug 1324.2 PROBLEM SOLVING: Hand-Tracing 1334.3 APPLICATION: Processing Sentinel Values 135ST2 Processing Sentinel Values with a Boolean Variable 138ST3 Redirection of Input and Output 1384.4 PROBLEM SOLVING: Storyboards 1394.5 Common Loop Algorithms 141Sum and Average Value 141Counting Matches 142Prompting Until a Match is Found 142Maximum and Minimum 142Comparing Adjacent Values 1434.6 The for Loop 145PT1 Count Iterations 148HT1 Writing a Loop 1494.7 Nested Loops 152WE1 Average Exam Grades 155WE2 A Grade Distribution Histogram 1574.8 Processing Strings 159Counting Matches 159Finding All Matches 160Finding the First or Last Match 160Validating a String 161Building a New String 1624.9 APPLICATION: Random Numbers and Simulations 164Generating Random Numbers 164Simulating Die Tosses 165The Monte Carlo Method 165WE3 GRAPHICS: Bull’s Eye 1674.10 GRAPHICS: Digital Image Processing 169Filtering Images 170Reconfiguring Images 1724.11 PROBLEM SOLVING: Solve a Simpler Problem First 174CS2 Digital Piracy 1805 Functions 1835.1 Functions as Black Boxes 1845.2 Implementing and Testing Functions 185Implementing a Function 186Testing a Function 186Programs that Contain Functions 187PT1 Function Comments 189PT2 Naming Functions 1905.3 Parameter Passing 190PT3 Do Not Modify Parameter Variables 191CE1 Trying to Modify Arguments 1925.4 Return Values 192ST1 Using Single-Line Compound Statements 193HT1 Implementing a Function 194WE1 Generating Random Passwords 1965.5 Functions Without Return Values 201CS1 Personal Computing 2025.6 PROBLEM SOLVING: Reusable Functions 2035.7 PROBLEM SOLVING: Stepwise Refinement 205PT4 Keep Functions Short 209PT5 Tracing Functions 210PT6 Stubs 211WE2 Calculating a Course Grade 211WE3 Using a Debugger 2145.8 Variable Scope 219PT7 Avoid Global Variables 221WE4 GRAPHICS: Rolling Dice 2215.9 GRAPHICS: Building an Image Processing Toolkit 224Getting Started 224Comparing Images 225Adjusting Image Brightness 226Rotating an Image 227Using the Toolkit 228WE5 Plotting Growth or Decay 2305.10 Recursive Functions (Optional) 232HT2 Thinking Recursively 234TOOLBOX 1 Turtle Graphics 2366 Lists 2456.1 Basic Properties of Lists 246Creating Lists 246Accessing List Elements 247Traversing Lists 248List References 249CE1 Out-of-Range Errors 250PT1 Use Lists for Sequences of Related Items 250ST1 Negative Subscripts 250ST2 Common Container Functions 251CS1 Computer Viruses 2516.2 List Operations 252Appending Elements 252Inserting an Element 253Finding an Element 254Removing an Element 254Concatenation and Replication 255Equality Testing 256Sum, Maximum, Minimum, and Sorting 256Copying Lists 256ST3 Slices 2586.3 Common List Algorithms 259Filling 259Combining List Elements 259Element Separators 260Maximum and Minimum 260Linear Search 261Collecting and Counting Matches 261Removing Matches 262Swapping Elements 263Reading Input 264WE1 Plotting Trigonometric Functions 2656.4 Using Lists with Functions 268ST4 Call by Value and Call by Reference 271ST5 Tuples 271ST6 Functions with a Variable Number of Arguments 272ST7 Tuple Assignment 272ST8 Returning Multiple Values with Tuples 273TOOLBOX 1 Editing Sound Files 2736.5 PROBLEM SOLVING: Adapting Algorithms 275HT1 Working with Lists 276WE2 Rolling the Dice 2786.6 PROBLEM SOLVING: Discovering Algorithms by Manipulating Physical Objects 2826.7 Tables 285Creating Tables 286Accessing Elements 287Locating Neighboring Elements 287Computing Row and Column Totals 288Using Tables with Functions 289WE3 A World Population Table 290ST9 Tables with Variable Row Lengths 292WE4 GRAPHICS: Drawing Regular Polygons 2937 Files and Exceptions 2997.1 Reading and Writing Text Files 300Opening a File 300Reading from a File 301Writing from a File 302A File Processing Example 302CE1 Backslashes in File Names 3037.2 Text Input and Output 304Iterating over the Lines of a File 304Reading Words 306Reading Characters 308Reading Records 309ST1 Reading the Entire File 312ST2 Regular Expressions 312ST3 Character Encodings 313TOOLBOX 1 Working with CSV Files 3147.3 Command Line Arguments 316HT1 Processing Text Files 319WE1 Analyzing Baby Names 322TOOLBOX 2 Working with Files and Directories 325CS1 Encryption Algorithms 3277.4 Binary Files and Random Access (Optional) 328Reading and Writing Binary Files 328Random Access 329Image Files 330Processing BMP Files 331WE2 GRAPHICS: Displaying a Scene File 3347.5 Exception Handling 337Raising Exceptions 338Handling Exceptions 339The finally Clause 341PT1 Raise Early, Handle Late 342PT2 Do Not Use except and finally in the Same try Statement 342ST4 The with Statement 343TOOLBOX 3 Reading Web Pages 3437.6 APPLICATION: Handling Input Errors 344TOOLBOX 4 Statistical Analysis 348WE3 Creating a Bubble Chart 352CS2 The Ariane Rocket Incident 3558 Sets and Dictionaries 3578.1 Sets 358Creating and Using Sets 358Adding and Removing Elements 359Subsets 360Set Union, Intersection, and Difference 361WE1 Counting Unique Words 364PT1 Use Python Sets, Not Lists, for Efficient Set Operations 366ST1 Hashing 367CS1 Standardization 3688.2 Dictionaries 368Creating Dictionaries 369Accessing Dictionary Values 370Adding and Modifying Items 370Removing Items 371Traversing a Dictionary 372ST2 Iterating over Dictionary Items 374ST3 Storing Data Records 375WE2 Translating Text Messages 3758.3 Complex Structures 378A Dictionary of Sets 378A Dictionary of Lists 381ST4 User Modules 383WE3 GRAPHICS: Pie Charts 384TOOLBOX 1 Harvesting JSON Data from the Web 3889 Objects and Classes 3939.1 Object-Oriented Programming 3949.2 Implementing a Simple Class 3969.3 Specifying the Public Interface of a Class 3999.4 Designing the Data Representation 401PT1 Make All Instance Variables Private, Most Methods Public 4029.5 Constructors 402CE1 Trying to Call a Constructor 404ST1 Default and Named Arguments 4049.6 Implementing Methods 405PT2 Define Instance Variables Only in the Constructor 407ST2 Class Variables 4089.7 Testing a Class 409HT1 Implementing a Class 410WE1 Implementing a Bank Account Class 4149.8 PROBLEM SOLVING: Tracing Objects 4169.9 PROBLEM SOLVING: Patterns for Object Data 419Keeping a Total 419Counting Events 420Collecting Values 420Managing Properties of an Object 421Modeling Objects with Distinct States 421Describing the Position of an Object 4229.10 Object References 423Shared References 424The None Reference 425The self Reference 426The Lifetime of Objects 426CS1 Electronic Voting 4279.11 APPLICATION: Writing a Fraction Class 428Fraction Class Design 428The Constructor 429Special Methods 430Arithmetic Operations 432Logical Operations 433ST3 Object Types and Instances 435WE2 GRAPHICS: A Die Class 436CS2 Open Source and Free Software 43910 Inheritance 44310.1 Inheritance Hierarchies 444PT1 Use a Single Class for Variation in Values, Inheritance for Variation in Behavior 447ST1 The Cosmic Superclass: object 44710.2 Implementing Subclasses 449CE1 Confusing Super- and Subclasses 45110.3 Calling the Superclass Constructor 45210.4 Overriding Methods 455CE2 Forgetting to Use the super Function When Invoking a Superclass Method 45810.5 Polymorphism 458ST2 Subclasses and Instances 461ST3 Dynamic Method Lookup 461ST4 Abstract Classes 462CE3 Don’t Use Type Tests 463HT1 Developing an Inheritance Hierarchy 463WE1 Implementing an Employee Hierarchy for Payroll Processing 46810.6 APPLICATION: A Geometric Shape Class Hierarchy 472The Base Class 472Basic Shapes 474Groups of Shapes 477TOOLBOX 1 Game Programming 48011 Recursion 48911.1 Triangle Numbers Revisited 490CE1 Infinite Recursion 493ST1 Recursion with Objects 49311.2 PROBLEM SOLVING: Thinking Recursively 494WE1 Finding Files 49711.3 Recursive Helper Functions 49811.4 The Efficiency of Recursion 49911.5 Permutations 504CS1 The Limits of Computation 50611.6 Backtracking 508WE2 Towers of Hanoi 51211.7 Mutual Recursion 515TOOLBOX 1 Analyzing Web Pages with Beautiful Soup 51912 Sorting and Searching 52512.1 Selection Sort 52612.2 Profiling the Selection Sort Algorithm 52812.3 Analyzing the Performance of the Selection Sort Algorithm 530ST1 Oh, Omega, and Theta 531ST2 Insertion Sort 53212.4 Merge Sort 53412.5 Analyzing the Merge Sort Algorithm 536ST3 The Quicksort Algorithm 538CS1 The First Programmer 54012.6 Searching 541Linear Search 541Binary Search 54212.7 PROBLEM SOLVING: Estimating the Running Time of an Algorithm 544Linear Time 545Quadratic Time 546The Triangle Pattern 547Logarithmic Time 548PT1 Searching and Sorting 549ST4 Comparing Objects 549WE1 Enhancing the Insertion Sort Algorithm 549Appendix A Python Operator Summary A-1Appendix B Python Reserved Word Summary A-3Appendix C The Python Standard Library A-5Appendix D The Basic Latin and Latin-1 Subsets of Unicode A-22Appendix E Binary Numbers and Bit Operations*Appendix F HTML Summary*Glossary R-1Index R-6Credits R-22Quick Reference R-23