
Nguồn ngoài
Think Python 2ed.
Think Python is an introduction to Python programming for beginners. It starts with basic concepts of programming, and is carefully designed to define all terms when they are first used and to develop each new concept in a logical progression. Larger pieces, like recursion and object-oriented programming are divided into a sequence of smaller steps and introduced over the course of several chapters.
- Tác giả
- Allen B. Downey
- Nhà xuất bản
- Olin College
- Nguồn
- LibreTexts
- Giấy phép
- CC BY-NC
- Ngôn ngữ
- EN
- Danh mục
- Công nghệ thông tin
Mục lục· 239 mục
- 01: The way of the program
- 1.01: What is a program
- 1.02: Running Python
- 1.03: The first program
- 1.04: Arithmetic operators
- 1.05: Values and types
- 1.06: Formal and natural languages
- 1.07: Debugging
- 1.08: Glossary
- 1.09: Exercises
- 02: Variables expressions and statements
- 2.01: Assignment statements
- 2.02: Variable names
- 2.03: Expressions and statements
- 2.04: Script mode
- 2.05: Order of operations
- 2.06: String operations
- 2.07: Comments
- 2.08: Debugging
- 2.09: Glossary
- 2.10: Exercises
- 03: Functions
- 3.01: Function calls
- 3.02: Math functions
- 3.03: Composition
- 3.04: Adding new functions
- 3.05: Definitions and uses
- 3.06: Flow of execution
- 3.07: Parameters and arguments
- 3.08: Variables and parameters are local
- 3.09: Stack diagrams
- 3.10: Fruitful functions and void functions
- 3.11: Why functions
- 3.12: Debugging
- 3.13: Glossary
- 3.14: Exercises
- 04: Case study - interface design
- 4.01: The turtle module
- 4.02: Simple repetition
- 4.03: Exercises
- 4.04: Encapsulation
- 4.05: Generalization
- 4.06: Interface design
- 4.07: Refactoring
- 4.08: A development plan
- 4.09: docstring
- 4.10: Debugging
- 4.11: Glossary
- 4.12: Exercises
- 05: Conditionals and recursion
- 5.01: Floor division and modulus
- 5.02: Boolean expressions
- 5.03: Logical operators
- 5.04: Conditional execution
- 5.05: Alternative execution
- 5.06: Chained conditionals
- 5.07: Nested conditionals
- 5.08: Recursion
- 5.09: Stack diagrams for recursive functions
- 5.10: Infinite recursion
- 5.11: Keyboard input
- 5.12: Debugging
- 5.13: Glossary
- 5.14: Exercises
- 06: Fruitful functions
- 6.01: Return values
- 6.02: Incremental development
- 6.03: Composition
- 6.04: Boolean functions
- 6.05: More recursion
- 6.06: Leap of faith
- 6.07: One more example
- 6.08: Checking types
- 6.09: Debugging
- 6.10: Glossary
- 6.11: Exercises
- 07: Iteration
- 7.01: Reassignment
- 7.02: Updating variables
- 7.03: The while statement
- 7.04: break
- 7.05: Square roots
- 7.06: Algorithms
- 7.07: Debugging
- 7.08: Glossary
- 7.09: Exercises
- 08: Strings
- 8.01: A string is a sequence
- 8.02: len
- 8.03: Traversal with a for loop
- 8.04: String slices
- 8.05: Strings are immutable
- 8.06: Searching
- 8.07: Looping and counting
- 8.08: String methods
- 8.09: The in operator
- 8.10: String comparison
- 8.11: Debugging
- 8.12: Glossary
- 8.13: Exercises
- 09: Case study - word play
- 9.01: Reading word lists
- 9.02: Exercises
- 9.03: Search
- 9.04: Looping with indices
- 9.05: Debugging
- 9.06: Glossary
- 9.07: Exercises
- 10: Lists
- 10.01: A list is a sequence
- 10.02: Lists are mutable
- 10.03: Traversing a list
- 10.04: List operations
- 10.05: List slices
- 10.06: List methods
- 10.07: Map filter and reduce
- 10.08: Deleting elements
- 10.09: Lists and strings
- 10.10: Objects and values
- 10.11: Aliasing
- 10.12: List arguments
- 10.13: Debugging
- 10.14: Glossary
- 10.15: Exercises
- 11: Dictionaries
- 11.01: A dictionary is a mapping
- 11.02: Dictionary as a collection of counters
- 11.03: Looping and dictionaries
- 11.04: Reverse lookup
- 11.05: Dictionaries and lists
- 11.06: Memos
- 11.07: Global variables
- 11.08: Debugging
- 11.09: Glossary
- 11.10: Exercises
- 12: Tuples
- 12.01: Tuples are immutable
- 12.02: Tuple assignment
- 12.03: Tuples as return values
- 12.04: Variable-length argument tuples
- 12.05: Lists and tuples
- 12.06: Dictionaries and tuples
- 12.07: Sequences of sequences
- 12.08: Debugging
- 12.09: Glossary
- 12.10: Exercises
- 13: Case study - data structure selection
- 13.01: Word frequency analysis
- 13.02: Random numbers
- 13.03: Word histogram
- 13.04: Most common words
- 13.05: Optional parameters
- 13.06: Dictionary subtraction
- 13.07: Random words
- 13.08: Markov analysis
- 13.09: Data structures
- 13.10: Debugging
- 13.11: Glossary
- 13.12: Exercises
- 14: Files
- 14.01: Persistence
- 14.02: Reading and writing
- 14.03: Format operator
- 14.04: Filenames and paths
- 14.05: Catching exceptions
- 14.06: Databases
- 14.07: Pickling
- 14.08: Pipes
- 14.09: Writing modules
- 14.10: Debugging
- 14.11: Glossary
- 14.12: Exercises
- 15: Classes and objects
- 15.01: Programmer-defined types
- 15.02: Attributes
- 15.03: Rectangles
- 15.04: Instances as return values
- 15.05: Objects are mutable
- 15.06: Copying
- 15.07: Debugging
- 15.08: Glossary
- 15.09: Exercises
- 16: Classes and functions
- 16.01: Time
- 16.02: Pure functions
- 16.03: Modifiers
- 16.04: Prototyping versus planning
- 16.05: Debugging
- 16.06: Glossary
- 16.07: Exercises
- 17: Classes and methods
- 17.01: Object-oriented features
- 17.02: Printing objects
- 17.03: Another example
- 17.04: A more complicated example
- 17.05: The init method
- 17.06: The str method
- 17.07: Operator overloading
- 17.08: Type-based dispatch
- 17.09: Polymorphism
- 17.10: Debugging
- 17.11: Interface and implementation
- 17.12: Glossary
- 17.13: Exercises
- 18: Inheritance
- 18.01: Card objects
- 18.02: Class attributes
- 18.03: Comparing cards
- 18.04: Decks
- 18.05: Printing the deck
- 18.06: Add remove shuffle and sort
- 18.07: Inheritance
- 18.08: Class diagrams
- 18.09: Debugging
- 18.10: Data encapsulation
- 18.11: Glossary
- 18.12: Exercises
- 19: The Goodies
- 19.01: Conditional expressions
- 19.02: List comprehensions
- 19.03: Generator expressions
- 19.04: any and all
- 19.05: Sets
- 19.06: Counters
- 19.07: defaultdict
- 19.08: Named tuples
- 19.09: Gathering keyword args
- 19.10: Glossary
- 19.11: Exercises
- 20: Appendix A - Debugging
- 20.01: Syntax errors
- 20.02: Runtime errors
- 20.03: Semantic errors
- 21: Appendix B - Analysis of Algorithms
- 21.01: Order of growth
- 21.02: Analysis of basic Python operations
- 21.03: Analysis of search algorithms
- 21.04: Hashtables
- 21.05: Glossary