页数:557页 开本:16开 重量:821g
《Python语言程序设计(英文版)》保持了Liang博士系列丛书中一贯的、标志性的教与学的哲学:以实例教,由实践学。书中采用了他所提出的已经经过实践检验的“基础先行”的方法,即在定义类之前,首先使用清晰简明的语言介绍基本程序设计概念,如选择语句、循环和函数;在介绍面向对象程序设计和GUI编程之前,首先介绍基本逻辑和程序设计概念。书中除了给出一些以游戏和数学为主的典型实例外,还在每章的开始使用简单的图形给出一两个例子,以激发学生的学习兴趣。
目录
Chapter 1 Introduction to Computers, Programs, and Python 1.1 Introduction 1.2 What Is a Computer? 1.3 Programming Languages 1.4 Operating Systems 1.5 The History of Python 1.6 Getting Started with Python 1.7 Programming Style and Documentation 1.8 Programming Errors 1.9 Getting Started with Graphics Programming Chapter 2 Elementary Programming 2.1 Introduction 2.2 Writing a Simple Program 2.3 Reading Input from the Console 2.4 Identifiers 2.5 Variables, Assignment Statements, and Expressions 2.6 Simultaneous Assignments 2.7 Named Constants 2.8 Numeric Data Types and Operators 2.9 Evaluating Expressions and Operator Precedence 2.10 Augmented Assignment Operators 2.1 I Type Conversions and Rounding 2.12 Case Study: Displaying the Current Time 2.13 Software Development Process 2.14 Case Study: Computing Distances Chapter 3 Mathematical Functions, Strings, and Objects 3.1 Introduction 3.2 Common Python Functions 3.3 Strings and Characters 3.4 Case Study: Minimum Number of Coins 3.5 Introduction to Objects and Methods 3.6 Formatting Numbers and Strings 3.7 Drawing Various Shapes 3.8 Drawing with Colors and Fonts Chapter 4 Selections 4.1 Introduction 4.2 Boolean Types, Values, and Expressions 4.3 Generating Random Numbers 4.4 if Statements 4.5 Case Study: Guessing Birthdays 4.6 Two-Way if-else Statements 4.7 Nested if and Multi-Way if-elif-else Statements 4.8 Common Errors in Selection Statements 4.9 Case Study: Computing Body Mass Index 4.10 Case Study: Computing Taxes 4.11 Logical Operators 4.12 Case Study: Determining Leap Years 4.13 Case Study: Lottery 4.14 Conditional Expressions 4.15 Operator Precedence and Associativity 4.16 Detecting the Location of an Object Chapter 5 Loops 5. I Introduction 5.2 The while Loop 5.3 The for Loop 5.4 Nested Loops 5.5 Minimizing Numerical Errors 5.6 Case Studies 5.7 Keywords break and continue 5.8 Case Study: Displaying Prime Numbers 5.9 Case Study: Random Walk Chapter 6 Functions 6.1 Introduction 6.2 Defining a Function 6.3 Calling a Function 6.4 Functions with/without Return Values 6.5 Positional and Keyword Arguments 6.6 Passing Arguments by Reference Values 6.7 Modularizing Code 6.8 Case Study: Converting Decimals to Hexadecimals 6.9 The Scope of Variables 6.10 Default Arguments 6.11 Returning Multiple Values 6.12 Case Study: Generating Random ASCII Characters 6.13 Function Abstraction and Stepwise Refinement 6.14 Case Study: Reusable Graphics Functions Chapter 7 Objects and Classes 7.1 Introduction 7.2 Defining Classes for Objects 7.3 UML Class Diagrams 7.4 Immutable Objects vs. Mutable Objects 7.5 Hiding Data Fields 7.6 Class Abstraction and Encapsulation 7.7 Object-Oriented Thinking Chapter 8 More on Strings and Special Methods 8.1 Introduction 8.2 The strClass 8.3 Case Study: Checking Palindromes 8.4 Case Study: Converting Hexadecimals to Decimals 8.5 Operator Overloading and Special Methods 8.6 Case Study: The Rational Class Chapter 9 GUI Programming Using Tkinter 9.1 Introduction 9.2 Getting Started with Tkinter 9.3 Processing Events 9.4 The Widget Classes 9.5 Canvas 9.6 The Geometry Managers 9.7 Case Study: Loan Calculator 9.8 Displaying Images 9.9 Menus 9.10 Popup Menus 9.11 Mouse, Key Events, and Bindings 9.12 Animations 9.13 Scrollbars 9.14 Standard Dialog Boxes Chapter 10 Lists 10.1 Introduction 10.2 List Basics 10.3 Case Study: Lotto Numbers 10.4 Case Study: Deck of Cards 10.5 Deck of Cards GUI 10.6 Copying Lists 10.7 Passing Lists to Functions 10.8 Returning a List from a Function 10.9 Case Study: Counting the Occurrences of Each Letter 10.10 Searching Lists 10.11 Sorting Lists 10.12 Case Study: Bouncing Balls Chapter 11 Multidimensional Lists 11.1 Introduction 11.2 Processing Two-Dimensional Lists 11.3 Passing Two-Dimensional Lists to Functions 11.4 Problem: Grading a Multiple-Choice Test 11.5 Problem: Finding the Closest Pair. 11.6 GUI: Finding the Closest Pair 11.7 Problem: Sudoku 11.8 Case Study: Sudoku GUI 11.9 Multidimensional Lists Chapter 12 Inheritance and Polymorphism 12. I Introduction 12.2 Superclasses and Subclasses 12.3 Overriding Methods 12.4 The object Class 12..5 Polymorphism and Dynamic Binding 12.6 The isinstance Function 12.7 Case Study: A Reusable Clock 12.B Class Relationships 12.9 Case Study: Designing the Course Class 12,10 Designing a Class for Stacks 12.11 Case Study: The FigureCanvas Class Chapter I3 Files and Exception Handling 13.1 Introduction 13.2 Text Input and Output 13.3 File Dialogs 13.4 Case Study: Counting Each Letter in a File 13.5 Retrieving Data from the Web 13.6 Exception Handling 13.7 Raising Exceptions 13.8 Processing Exceptions Using Exception Objects 13.9 Defining Custom Exception Classes 13.10 Binary IO Using Pickling 13.1 I Case Study: Address Book Chapter 14 Tuples, Sets, and Dictionaries 14.1 Introduction 14.2 Tuples 14.3 Sets 14.4 Comparing the Performance of Sets and Lists 14,5 Case Study: Counting Keywords 14.6 Dictionaries 14.7 Case Study: Occurrences of Words Chapter 15 Recursion 15.1 Introduction 15.2 Case Study: Computing Factorials 15.3 Case Study: Computing Fibonacci Numbers 15.4 Problem Solving Using Recursion 15.5 Recursive Helper Functions 15.6 Case Study: Finding the Directory Size 15.7 Case Study: Towers of Hanoi 15.8 Case Study: Fractals 15.9 Case Study: Eight Queens 15.10 Recursion vs. Iteration 15.11 Tail Recursion A detailed table of contents for the Web chapters is available on the companion Website: Chapter 1 6 Developing Efficient Algorithms Chapter 17 Sorting Chapter 18 Linked Lists, Stacks, Queues, and Priority Queues Chapter 19 Binary Search Trees Chapter 20 AVL Trees Chapter 21 Hashing: Implementing Dictionaries and Sets Chapter 22 Graphs and Applications Chapter 23 Weighted Graphs and Applications APPENDIXES Appendix A Python Keywords Appendix B The ASCII Character Set Appendix C Number Systems INDEX CREDITS |
|