Downey, Allen

Think Python/ Allen B. Downey. - Sebastopol, CA : O'Reilly, 2012. - xviii,277p. : ill. ; 24cm.

Includes index. "How to think like a computer scientist"--Cover.

1. The Way of the Program.
The Python Programming Language
What Is a Program?
What Is Debugging?
Syntax Errors
Runtime Errors
Semantic Errors
Experimental Debugging
Formal and Natural Languages
The First Program
Debugging
Glossary
Exercises
2. Variables, Expressions, and Statements.
Values and Types
Variables
Variable Names and Keywords
Operators and Operands
Expressions and Statements
Interactive Mode and Script Mode
Order of Operations
String Operations
Comments
Debugging
Glossary
3. Functions.
Function Calls
Type Conversion Functions
Math Functions
Composition
Adding New Functions
Definitions and Uses
Flow of Execution
Parameters and Arguments
Variables and Parameters Are Local
Stack Diagrams
Fruitful Functions and Void Functions
Why Functions?
Importing with from
Debugging
Glossary
Exercises
4. Case Study: Interface Design
TurtleWorld
Simple Repetition
Exercises
Encapsulation
Generalization
Interface Design
Refactoring
A Development Plan
Docstring
Debugging
Glossary
Exercises
5. Conditionals and Recursion.
Modulus Operator
Boolean Expressions
Logical Operators
Conditional Execution
Alternative Execution
Chained Conditionals
Nested Conditionals
Table of Contents
Recursion
Stack Diagrams for Recursive Functions
Infinite Recursion
Keyboard Input
Debugging
Glossary
Exercises
6. Fruitful Functions
Return Values
Incremental Development
Composition
Boolean Functions
More Recursion
Leap of Faith
One More Example
Checking Types
Debugging
Glossary
Exercises
7. Iteration.
Multiple Assignment
Updating Variables
The while Statement
break
Square Roots
Algorithms
Debugging
Glossary
Exercises
8. Strings..
A String Is a Sequence
len
Traversal with a for Loop
String Slices
Strings Are Immutable
Searching
Looping and Counting
String Methods
The in Operator
String Comparison
Debugging
Glossary
Exercises
9. Case Study: Word Play.
Reading Word Lists
Exercises
Search
Looping with Indices
Debugging
Glossary
Exercises
10. Lists.
A List Is a Sequence
Lists Are Mutable
Traversing a List
List Operations
List Slices
List Methods
Map, Filter, and Reduce
Deleting Elements
Lists and Strings
Objects and Values
Aliasing
List Arguments
Debugging
Glossary
Exercises
11. Dictionaries.
Dictionary as a Set of Counters
Looping and Dictionaries
Reverse Lookup
Dictionaries and Lists
Memos
Global Variables
Long Integers
Debugging
Glossary
12. Tuples.
Tuples Are Immutable
Tuple Assignment
Tuples as Return Values
Variable-Length Argument Tuples
Lists and Tuples
Dictionaries and Tuples
Comparing Tuples
Sequences of Sequences
Debugging
Glossary
Exercises
13. Case Study: Data Structure Selection.
Word Frequency Analysis
Random Numbers
Word Histogram
Most Common Words
Optional Parameters
Dictionary Subtraction
Random Words
Markov Analysis
Data Structures
Debugging
Glossary
, Exercises
14. Files.
Persistence
Reading and Writing
Format Operator
Filenames and Paths
Catching Exceptions
Databases
Pickling
Pipes
Writing Modules
Debugging
Glossary
15. Classes and Objects.
User-Defined Types
Attributes
Rectangles
Instances as Return Values .
Objects Are Mutable
Copying
Debugging
Glossary
Exercises
16. Classes and Functions
Time
Pure Functions
Modifiers
Prototyping Versus Planning
Debugging
Glossary
Exercises
17. Classes and Methods.
Object-Oriented Features
Printing Objects
Another Example
A More Complicated Example
The init Method
The str Method
Operator Overloading
Type-Based Dispatch
Polymorphism
Debugging
Interface and Implementation
Glossary
Exercises
18. Inheritance.
Card Objects
Class Attributes
Comparing Cards
Decks
Printing the Deck
Add, Remove, Shuffle, and Sort
Inheritance
Class Diagrams
Debugging
Data Encapsulation
Glossary
Exercises
19. Case Study: Tkinter.
GUI
Buttons and Callbacks
Canvas Widgets
Coordinate Sequences
More Widgets
Packing Widgets
Menus and Callables
Binding
Debugging
Glossary
Exercises

9781449330729 144933072X


Python (Computer program language)
Python (Computer program language)

005.133 / WIT/T