This page intentionally left blank Python for Software Design



tải về 1.38 Mb.
Chế độ xem pdf
trang83/83
Chuyển đổi dữ liệu13.08.2023
Kích1.38 Mb.
#55046
1   ...   75   76   77   78   79   80   81   82   83
- Python for Software Design How to Think Like a Computer Scientist-Cambridge University Press (2009)

Document Outline

  • Cover
  • Half-title
  • Title
  • Copyright
  • Contents
  • Preface
  • Python for Software Design
  • 1 The Way of the Program
    • 1.1 THE PYTHON PROGRAMMING LANGUAGE
    • 1.2 WHAT IS A PROGRAM?
    • 1.3 WHAT IS DEBUGGING?
      • 1.3.1 Syntax Errors
      • 1.3.2 Runtime Errors
      • 1.3.3 Semantic Errors
      • 1.3.4 Experimental Debugging
    • 1.4 FORMAL AND NATURAL LANGUAGES
      • Exercise 1.1
    • 1.5 THE FIRST PROGRAM
    • 1.6 DEBUGGING
    • 1.7 GLOSSARY
    • 1.8 EXERCISES
      • Exercise 1.2
      • Exercise 1.3
      • Exercise 1.4
  • 2 Variables, Expressions, and Statements
    • 2.1 VALUES AND TYPES
    • 2.2 VARIABLES
      • Exercise 2.1
    • 2.3 VARIABLE NAMES AND KEYWORDS
    • 2.4 STATEMENTS
    • 2.5 OPERATORS AND OPERANDS
    • 2.6 EXPRESSIONS
      • Exercise 2.2
    • 2.7 ORDER OF OPERATIONS
    • 2.8 STRING OPERATIONS
    • 2.9 COMMENTS
    • 2.10 DEBUGGING
    • 2.11 GLOSSARY
    • 2.12 EXERCISES
      • Exercise 2.3
      • Exercise 2.4
  • 3 Functions
    • 3.1 FUNCTION CALLS
    • 3.2 TYPE CONVERSION FUNCTIONS
    • 3.3 MATH FUNCTIONS
    • 3.4 COMPOSITION
    • 3.5 ADDING NEW FUNCTIONS
    • 3.6 DEFINITIONS AND USES
      • Exercise 3.1
      • Exercise 3.2
    • 3.7 FLOW OF EXECUTION
    • 3.8 PARAMETERS AND ARGUMENTS
    • 3.9 VARIABLES AND PARAMETERS ARE LOCAL
    • 3.10 STACK DIAGRAMS
    • 3.11 FRUITFUL FUNCTIONS AND VOID FUNCTIONS
    • 3.12 WHY FUNCTIONS?
    • 3.13 DEBUGGING
    • 3.14 GLOSSARY
    • 3.15 EXERCISES
      • Exercise 3.3
      • Exercise 3.4
      • Exercise 3.5
  • 4 Case Study: Interface Design
    • 4.1 TURTLEWORLD
    • 4.2 SIMPLE REPETITION
    • 4.3 EXERCISES
    • 4.4 ENCAPSULATION
    • 4.5 GENERALIZATION
    • 4.6 INTERFACE DESIGN
    • 4.7 REFACTORING
    • 4.8 A DEVELOPMENT PLAN
    • 4.9 DOCSTRING
    • 4.10 DEBUGGING
    • 4.11 GLOSSARY
    • 4.12 EXERCISES
      • Exercise 4.1
      • Exercise 4.2
      • Exercise 4.3
      • Exercise 4.4
  • 5 Conditionals and Recursion
    • 5.1 MODULUS OPERATOR
    • 5.2 BOOLEAN EXPRESSIONS
    • 5.3 LOGICAL OPERATORS
    • 5.4 CONDITIONAL EXECUTION
    • 5.5 ALTERNATIVE EXECUTION
    • 5.6 CHAINED CONDITIONALS
    • 5.7 NESTED CONDITIONALS
    • 5.8 RECURSION
    • 5.9 STACK DIAGRAMS FOR RECURSIVE FUNCTIONS
    • 5.10 INFINITE RECURSION
    • 5.11 KEYBOARD INPUT
    • 5.12 DEBUGGING
    • 5.13 GLOSSARY
    • 5.14 EXERCISES
      • Exercise 5.1
      • Exercise 5.2
      • Exercise 5.3
      • Exercise 5.4
  • 6 Fruitful Functions
    • 6.1 RETURN VALUES
      • Exercise 6.1
    • 6.2 INCREMENTAL DEVELOPMENT
      • Exercise 6.2
    • 6.3 COMPOSITION
    • 6.4 BOOLEAN FUNCTIONS
      • Exercise 6.3
    • 6.5 MORE RECURSION
    • 6.6 LEAP OF FAITH
    • 6.7 ONE MORE EXAMPLE
    • 6.8 CHECKING TYPES
    • 6.9 DEBUGGING
    • 6.10 GLOSSARY
    • 6.11 EXERCISES
      • Exercise 6.4
      • Exercise 6.5
      • Exercise 6.6
      • Exercise 6.7
      • Exercise 6.8
  • 7 Iteration
    • 7.1 MULTIPLE ASSIGNMENT
    • 7.2 UPDATING VARIABLES
    • 7.3 THE while STATEMENT
      • Exercise 7.1
    • 7.4 break
    • 7.5 SQUARE ROOTS
      • Exercise 7.2
    • 7.6 ALGORITHMS
    • 7.7 DEBUGGING
    • 7.8 GLOSSARY
    • 7.9 EXERCISES
      • Exercise 7.3
      • Exercise 7.4
      • Exercise 7.5
  • 8 Strings
    • 8.1 A STRING IS A SEQUENCE
    • 8.2 len
    • 8.3 TRAVERSAL WITH A for LOOP
      • Exercise 8.1
      • Exercise 8.2
    • 8.4 STRING SLICES
      • Exercise 8.3
    • 8.5 STRINGS ARE IMMUTABLE
    • 8.6 SEARCHING
      • Exercise 8.4
    • 8.7 LOOPING AND COUNTING
      • Exercise 8.5
      • Exercise 8.6
    • 8.8 string METHODS
      • Exercise 8.7
    • 8.9 THE in OPERATOR
    • 8.10 STRING COMPARISON
    • 8.11 DEBUGGING
      • Exercise 8.8
    • 8.12 GLOSSARY
    • 8.13 EXERCISES
      • Exercise 8.9
      • Exercise 8.10
      • Exercise 8.11
      • Exercise 8.12
  • 9 Case Study: Word Play
    • 9.1 READING WORD LISTS
      • Exercise 9.1
    • 9.2 EXERCISES
      • Exercise 9.2
      • Exercise 9.3
      • Exercise 9.4
      • Exercise 9.5
      • Exercise 9.6
    • 9.3 SEARCH
    • 9.4 LOOPING WITH INDICES
    • 9.5 DEBUGGING
    • 9.6 GLOSSARY
    • 9.7 EXERCISES
      • Exercise 9.7
      • Exercise 9.8
      • Exercise 9.9
  • 10 Lists
    • 10.1 A LIST IS A SEQUENCE
    • 10.2 LISTS ARE MUTABLE
    • 10.3 TRAVERSING A LIST
    • 10.4 LIST OPERATIONS
    • 10.5 LIST SLICES
    • 10.6 LIST METHODS
    • 10.7 MAP, FILTER, AND REDUCE
      • Exercise 10.1
    • 10.8 DELETING ELEMENTS
    • 10.9 LISTS AND STRINGS
    • 10.10 OBJECTS AND VALUES
    • 10.11 ALIASING
    • 10.12 LIST ARGUMENTS
      • Exercise 10.2
    • 10.13 DEBUGGING
    • 10.14 GLOSSARY
    • 10.15 EXERCISES
      • Exercise 10.3
      • Exercise 10.4
      • Exercise 10.5
      • Exercise 10.6
      • Exercise 10.7
      • Exercise 10.8
      • Exercise 10.9
      • Exercise 10.10
  • 11 Dictionaries
    • 11.1 DICTIONARY AS A SET OF COUNTERS
      • Exercise 11.2
    • 11.2 LOOPING AND DICTIONARIES
      • Exercise 11.3
    • 11.3 REVERSE LOOKUP
      • Exercise 11.4
    • 11.4 DICTIONARIES AND LISTS
      • Exercise 11.5
    • 11.5 MEMOS
      • Exercise 11.6
    • 11.6 GLOBAL VARIABLES
    • 11.7 LONG INTEGERS
      • Exercise 11.7
    • 11.8 DEBUGGING
    • 11.9 GLOSSARY
    • 11.10 EXERCISES
      • Exercise 11.8
      • Exercise 11.9
      • Exercise 11.10
  • 12 Tuples
    • 12.1 TUPLES ARE IMMUTABLE
    • 12.2 TUPLE ASSIGNMENT
    • 12.3 TUPLES AS RETURN VALUES
    • 12.4 VARIABLE-LENGTH ARGUMENT TUPLES
      • Exercise 12.1
    • 12.5 LISTS AND TUPLES
    • 12.6 DICTIONARIES AND TUPLES
    • 12.7 COMPARING TUPLES
      • Exercise 12.2
    • 12.8 SEQUENCES OF SEQUENCES
    • 12.9 DEBUGGING
    • 12.10 GLOSSARY
    • 12.11 EXERCISES
      • Exercise 12.3
      • Exercise 12.4
      • Exercise 12.5
  • 13 Case Study: Data Structure Selection
    • 13.1 WORD FREQUENCY ANALYSIS
      • Exercise 13.1
      • Exercise 13.2
      • Exercise 13.3
      • Exercise 13.4
    • 13.2 RANDOM NUMBERS
      • Exercise 13.5
    • 13.3 WORD HISTOGRAM
    • 13.4 MOST COMMON WORDS
    • 13.5 OPTIONAL PARAMETERS
    • 13.6 DICTIONARY SUBTRACTION
      • Exercise 13.6
    • 13.7 RANDOM WORDS
      • Exercise 13.7
    • 13.8 MARKOV ANALYSIS
      • Exercise 13.8
    • 13.9 DATA STRUCTURES
    • 13.10 DEBUGGING
    • 13.11 GLOSSARY
    • 13.12 EXERCISES
      • Exercise 13.9
  • 14 Files
    • 14.1 PERSISTENCE
    • 14.2 READING AND WRITING
    • 14.3 FORMAT OPERATOR
    • 14.4 FILENAMES AND PATHS
      • Exercise 14.1
      • Exercise 14.2
    • 14.5 CATCHING EXCEPTIONS
    • 14.6 DATABASES
    • 14.7 PICKLING
      • Exercise 14.3
    • 14.8 PIPES
    • 14.9 WRITING MODULES
      • Exercise 14.4
    • 14.10 DEBUGGING
    • 14.11 GLOSSARY
    • 14.12 EXERCISES
      • Exercise 14.5
      • Exercise 14.6
      • Exercise 14.7
  • 15 Classes and Objects
    • 15.1 USER-DEFINED TYPES
    • 15.2 ATTRIBUTES
      • Exercise 15.1
    • 15.3 RECTANGLES
    • 15.4 INSTANCES AS RETURN VALUES
    • 15.5 OBJECTS ARE MUTABLE
      • Exercise 15.2
    • 15.6 COPYING
      • Exercise 15.3
    • 15.7 DEBUGGING
    • 15.8 GLOSSARY
    • 15.9 EXERCISES
      • Exercise 15.4
  • 16 Classes and Functions
    • 16.1 TIME
      • Exercise 16.1
      • Exercise 16.2
    • 16.2 PURE FUNCTIONS
    • 16.3 MODIFIERS
      • Exercise 16.3
      • Exercise 16.4
    • 16.4 PROTOTYPING VERSUS PLANNING
      • Exercise 16.5
    • 16.5 DEBUGGING
    • 16.6 GLOSSARY
    • 16.7 EXERCISES
      • Exercise 16.6
      • Exercise 16.7
      • Exercise 16.8
  • 17 Classes and Methods
    • 17.1 OBJECT-ORIENTED FEATURES
    • 17.2 PRINTING OBJECTS
      • Exercise 17.1
    • 17.3 ANOTHER EXAMPLE
    • 17.4 A MORE COMPLICATED EXAMPLE
    • 17.5 THE INIT METHOD
      • Exercise 17.2
    • 17.6 THE METHOD
      • Exercise 17.3
    • 17.7 OPERATOR OVERLOADING
      • Exercise 17.4
    • 17.8 TYPE-BASED DISPATCH
      • Exercise 17.5
    • 17.9 POLYMORPHISM
    • 17.10 DEBUGGING
    • 17.11 GLOSSARY
    • 17.12 EXERCISES
      • Exercise 17.6
      • Exercise 17.7
  • 18 Inheritance
    • 18.1 CARD OBJECTS
    • 18.2 CLASS ATTRIBUTES
    • 18.3 COMPARING CARDS
      • Exercise 18.1
    • 18.4 DECKS
    • 18.5 PRINTING THE DECK
    • 18.6 ADD, REMOVE, SHUFFLE, AND SORT
      • Exercise 18.2
    • 18.7 INHERITANCE
      • Exercise 18.3
    • 18.8 CLASS DIAGRAMS
      • Exercise 18.4
    • 18.9 DEBUGGING
    • 18.10 GLOSSARY
    • 18.11 EXERCISES
      • Exercise 18.5
      • Exercise 18.6
  • 19 Case Study: Tkinter
    • 19.1 GUI
    • 19.2 BUTTONS AND CALLBACKS
      • Exercise 19.1
    • 19.3 CANVAS WIDGETS
      • Exercise 19.2
    • 19.4 COORDINATE SEQUENCES
    • 19.5 MORE WIDGETS
      • Exercise 19.3
    • 19.6 PACKING WIDGETS
    • 19.7 MENUS AND CALLABLES
    • 19.8 BINDING
    • 19.9 DEBUGGING
    • 19.10 GLOSSARY
    • 19.11 EXERCISES
      • Exercise 19.4
      • Exercise 19.5
      • Exercise 19.6
  • Appendix Debugging
    • A.1 SYNTAX ERRORS
      • A.1.1 I Keep Making Changes and It Makes No Difference
    • A.2 RUNTIME ERRORS
      • A.2.1 My Program Does Absolutely Nothing
        • A.2.2 My Program Hangs
          • A.2.2.1 Infinite Loop
          • A.2.2.2 Infinite Recursion
          • A.2.2.3 Flow of Execution
        • A.2.3 When I Run the Program I Get an Exception
        • A.2.4 I Added so Many print Statements I Get Inundated with Output
    • A.3 SEMANTIC ERRORS
      • A.3.1 My Program Does not Work
      • A.3.2 I’ve Got A Big Hairy Expression and It Doesn’t Do What I Expect
      • A.3.3 I’ve Got a Function or Method That Doesn’t Return What I Expect
      • A.3.4 I’m Really, Really Stuck and I Need Help
      • A.3.5 No, I Really Need Help
  • Index

tải về 1.38 Mb.

Chia sẻ với bạn bè của bạn:
1   ...   75   76   77   78   79   80   81   82   83




Cơ sở dữ liệu được bảo vệ bởi bản quyền ©hocday.com 2024
được sử dụng cho việc quản lý

    Quê hương