Learning With Python

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

How to Think Like a Computer Scientist

Learning with Python


IN THIS BOOK, YOU WILL LEARN ABOUT:

BASICS OF PYTHON: Variables, Expressions and


Statements, Loops, Functions, Strings

LIST AND TUPLES: Accessing elements, List


length, List membership, Lists and for loops, List
operations, List slices, Lists are mutable, List
deletion, Tuple assignment, Tuples as return
values

DICTIONARIES: Dictionary operations,


Dictionary methods, Sparse matrices

FILES AND EXCEPTIONS: Text files,


Writing variables, Directories, Pickling

CLASSES AND OBJECTS: User-defined


compound types, Attributes, Instances
as arguments

LINKED LISTS AND STACKS: The Node


class, Lists as collections, Lists and
recursion, Infinite lists, Modifying lists, The
Stack ADT, Pushing and popping, Parsing

QUEUES AND TREES: Linked queue, Priority


queue, The Golfer class, Building trees, Traversing
trees,

`299

ABOUT THE BOOK


The book is designed to introduce the important concepts of Python programming language in detail. The reader
will be able to develop and execute the programs in Python. This book will also help the readers to learn about
Functions, Recursion, Iterative Statements, Strings, Lists, Tuples, Dictionaries, Files and Exceptions, Classes
and Objects, Methods, Inheritance, Linked Lists, Stacks, Queues and Trees.

ISBN: 9789351198147 | Pages: 280 | Authors: Downey, Elkner, Meyers

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

Values and types


Variables
Variable names and keywords
Statements
Evaluating expressions
Operators and operands
Order of operations
Operations on strings
Composition
Comments
Glossary

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

The modulus operator


Boolean expressions
Logical operators
Conditional execution
Alternative execution
Chained conditionals
Nested conditionals
The return statement
Recursion
Stack diagrams for recursive
functions
yy Infinite recursion
yy Keyboard input
yy Glossary
5 Fruitful functions
yy Return values
yy Program development
yy Composition
yy Boolean functions
yy More recursion
Published by:

/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

A compound data type


Length
Traversal and the for loop
String slices
String comparison
Strings are immutable
A find function
Looping and counting
The string module
Character classification
Glossary

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

Mutability and tuples


Tuple assignment
Tuples as return values
Random numbers
List of random numbers
Counting
Many buckets
A single-pass solution
Glossary

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

You might also like