Table of Contents
+-What is a program?
Running Python
The first program
Arithmetic operators
Values and types
Formal and natural languages
+-Assignment statements
Variable names
Expressions and statements
Script mode
Order of operations
String operations
Comments
+-Function calls
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?
+-The turtle module
Simple repetition
Encapsulation
Generalization
Interface design
Refactoring
A development plan
docstring
+-Floor division and modulus
Boolean expressions
Logical operators
Conditional execution
Alternative execution
Chained conditionals
Nested conditionals
Recursion
Stack diagrams for recursive functions
Infinite recursion
Keyboard input
+-Return values
Incremental development
Composition
Boolean functions
More recursion
Leap of faith
One more example
Checking types
+-Reassignment
Updating variables
The while statement
break
Square roots
Algorithms
+-What is a string?
Traversing a string
String operations
Strings are immutable
Searching
Looping and counting
String methods
The in operator
String comparison
+-Reading word lists
Search
Looping with indices
+-What is a list?
Traversing a list
List operations
Map, filter and reduce
Deleting elements
Lists and strings
Objects and values
Aliasing
List arguments
+-What is a dictionary?
A collection of counters
Traversing a dictionary
Reverse lookup
Dictionaries and lists
Memos
Global variables
+-What is a tuple?
Tupple assignment
Tuples as return values
Variable-length arument tuples
Lists and tuples
Dictionaries and tuples
Sequencies of sequencies
+-Word frequency analysis
Random numbers
Word histogram
Most common words
Optional parameters
Dictionary substraction
Random words
Markov analysis
Data structures
+-Persistence
Reading and writing
Format operator
Filenames and paths
Catch exceptions
Databases
Pickling
Pipes
Writing modules
+-Customized types
Attributes
Rectangles
Instances and return values
Objects are mutable
Copying
+-Time
Pure functions
Modifiers
Prototyping vs planning
+-Object-oriented features
Printing objects
The init method
The __str__ method
Operator overloading
Type-based dispatch
Polymorphism
+-Card objects
Class attributes
Comparing cards
Decks
Printing the deck
Add, remove, shuffle and sort
Inheritance
Class diagrams
+-Conditional expressions
List compressions
Generator expressions
any and all
Sets
Counters
defaultdict
Named tuples
Gathering keyword args