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.11 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 i f 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.1 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 withwithout 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 str class
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
cbapter 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.1 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.8 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 13 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.11 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.1 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 16 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