Learning With Python
Learning With Python
Learning With Python
`299
Table of Contents
1 The way of the program
yy The Python programming
language
yy What is a program?
yy What is debugging
yy Formal and natural languages
yy The first program
yy Glossary
2 Variables, expressions and
statements
yy
yy
yy
yy
yy
yy
yy
yy
yy
yy
yy
3 Functions
yy
yy
yy
yy
yy
yy
yy
yy
yy
yy
Function calls
Type conversion
Type coercion
Math functions
Composition
Adding new functions
Definitions and use
Flow of execution
Parameters and arguments
Variables and parameters
are local
yy Stack diagrams
yy Functions with results
yy Glossary
4 Conditionals and recursion
yy
yy
yy
yy
yy
yy
yy
yy
yy
yy
/dtechpress
yy
yy
yy
yy
Leap of faith
One more example
Checking types
Glossary
6 Iteration
yy
yy
yy
yy
yy
yy
yy
yy
yy
yy
Multiple assignment
The while statement
Tables
Two-dimensional tables
Encapsulation and
generalization
More encapsulation
Local variables
More generalization
Functions
Glossary
7 Strings
yy
yy
yy
yy
yy
yy
yy
yy
yy
yy
yy
8 Lists
yy
yy
yy
yy
yy
yy
yy
yy
yy
yy
yy
yy
yy
yy
yy
yy
yy
List values
Accessing elements
List length
List membership
Lists and for loops
List operations
List slices
Lists are mutable
List deletion
Objects and values
Aliasing
Cloning lists
List parameters
Nested lists
Matrices
Strings and lists
Glossary
9 Tuples
yy
yy
yy
yy
yy
yy
yy
yy
yy
10 Dictionaries
yy Dictionary operations
yy Dictionary methods
yy Aliasing and copying
yy Sparse matrices
yy Hints
yy Long integers
yy Counting letters
yy Glossary
11 Files and exceptions
yy Text files
yy Writing variables
yy Directories
yy Pickling
yy Exceptions
yy Glossary
12 Classes and objects
yy User-defined compound types
yy Attributes
yy Instances as arguments
yy Sameness
yy Rectangles
yy Instances as return values
yy Objects are mutable
yy Copying
yy Glossary
13 Classes and functions
yy Time
yy Pure functions
yy Modifiers
yy Which is better?
yy Prototype development versus
planning
yy Generalization
yy Algorithms
yy Glossary
14 Classes and methods
yy Object-oriented features
yy printTime
yy Another example
yy A more complicated example
yy Optional arguments
yy The initialization method
yy Points revisited
yy Operator overloading
yy Polymorphism
yy Glossary
15 Sets of objects
yy Composition
yy Card objects
yy Class attributes and the str
method
yy Comparing cards
yy Decks
yy Printing the deck
yy Shuffling the deck
yy Removing and dealing cards
yy Glossary
16 Inheritance
yy Inheritance
yy A hand of cards
yy Dealing cards
yy Printing a Hand
yy The CardGame class
yy OldMaidHand class
yy OldMaidGame class
yy Glossary
17 Linked lists
yy Embedded references
yy The Node class
yy Lists as collections
yy Lists and recursion
yy Infinite lists
yy The fundamental ambiguity
theorem
yy Modifying lists
yy Wrappers and helpers
yy The LinkedList class
yy Invariants
yy Glossary
18 Stacks
yy Abstract data types
yy The Stack ADT
yy Implementing stacks with
Python lists
yy Pushing and popping
yy Using a stack to evaluate
postfix
yy Parsing
yy Evaluating postfix
yy Clients and providers
yy Glossary
19 Queues
yy The Queue ADT
yy Linked Queue
yy Performance characteristics
yy Contents xxvii
yy Improved Linked Queue
yy Priority queue
yy The Golfer class
yy Glossary
20 Trees
yy Building trees
yy Traversing trees
yy Expression trees
yy Tree traversal
yy Building an expression tree
yy Handling errors
yy The animal tree
yy Glossary
ADebugging
BCreating a new data type
C Recommendations for
further reading
DREAMTECH PRESS
WILEY INDIA PVT. LTD.
19-A, Ansari Road, Daryaganj
4435-36/7, Ansari Road, Daryaganj
New Delhi-110 002, INDIA
New Delhi-110 002, INDIA
Tel: +91-11-2324 3463-73, Fax: +91-11-2324 3078
Tel: +91-11-4363 0000, Fax: +91-11-2327 5895
Email: [email protected]
Email: [email protected]
Website: www.dreamtechpress.com
Website: www.wileyindia.com
Regional Offices: Bangalore: Tel: +91-80-2313 2383, Fax: +91-80-2312 4319, Email: [email protected]
Mumbai: Tel: +91-22-2788 9263, 2788 9272, Telefax: +91-22-2788 9263, Email: [email protected]
/dtechpress
/dreamtechpress
dreamtechpress.wordpress.com
Execlusively
Distributed by:
/company/dreamtech-press