Learning with Python
- New Delhi Wiley India Pvt. Ltd. 2016
- xxviii, 250 p.
Table of content 1. The way of the program
The Python programming language What is a program? What is debugging? Formal and natural languages The first program
2. Variables, expressions and statements
Values and types Variables Variable names and keywords Statements Evaluating expressions Operators and operands Order of operations Operations on strings Composition Comments
3. Functions
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 Stack diagrams Functions with results
4. Conditionals and recursion
The modulus operator Boolean expressions Logical operators Conditional execution Alternative execution Chained conditionals Nested conditionals The return statement Recursion Stack diagrams for recursive functions Infinite recursion Keyboard input
5. Fruitful functions
Return values Program development Composition Boolean functions More recursion Leap of faith One more example Checking types
6. Iteration
Multiple assignment The while statement Tables Two-dimensional tables Encapsulation and generalization More encapsulation Local variables More generalization Functions
7. Strings
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
8. Lists
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
9. Tuples
Mutability and tuples Tuple assignment Tuples as return values Random numbers List of random numbers Counting Many buckets A single-pass solution
10. Dictionaries
Dictionary operations Dictionary methods Aliasing and copying Sparse matrices Hints Long integers Counting letters
11. Files and exceptions
Text files Writing variables Directories Pickling Exceptions
12. Classes and objects
User-defined compound types Attributes Instances as arguments Sameness Rectangles Instances as return values Objects are mutable Copying
13. Classes and functions
Time Pure functions Modifiers Which is better? Prototype development versus planning Generalization Algorithms
14. Classes and methods
Object-oriented features printTime Another example A more complicated example Optional arguments The initialization method Points revisited Operator overloading Polymorphism
15. Sets of objects
Composition Card objects Class attributes and the str method Comparing cards Decks Printing the deck Shuffling the deck Removing and dealing cards
16. Inheritance
Inheritance A hand of cards Dealing cards Printing a Hand The CardGame class OldMaidHand class OldMaidGame class
17. Linked lists
Embedded references The Node class Lists as collections Lists and recursion Infinite lists The fundamental ambiguity theorem Modifying lists Wrappers and helpers The Linked List class Invariants
18. Stacks
Abstract data types The Stack ADT. . . Implementing stacks with Python lists Pushing and popping Using a stack to evaluate postfix Parsing Evaluating postfix Clients and providers
19. Queues
The Queue ADT Linked Queue Performance characteristics Improved Linked Queue Priority queue The Golfer class
20. Trees
Building trees Traversing trees Expression trees Tree traversal Building an expression tree Handling errors The animal tree
Debugging
Syntax errors Runtime errors Semantic errors
Creating a new data type
Fraction multiplication Fraction addition Euclid’s algorithm Comparing fractions Taking it further
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.
9789351198147
Machine learning Python (Computer program language) Big data