Cover
Title Page
Half Title
Copyright Page
Organization of the Book
Table of Contents
1. Introduction to Python Language
1.1 Programming Language
1.2 History of Python Language
1.3 Origin of Python Programming Language
1.4 Features of Python
1.5 Limitations of Python
1.6 Major Applications of Python
1.7 Getting Python
1.8 Installing Python
1.8.1 Unix and Linux Installation
1.8.2 Windows Installation
1.8.3 Macintosh Installation
1.9 Setting up Path
1.9.1 Setting up Path at Unix/Linux
1.9.2 Setting up the Path at windows
1.10 Python Environment Variables
1.11 Running Python
1.11.1 Interactive Interpreter
1.11.2 Script from the Command-Line
1.11.3 Integrated Development Environment
1.12 First Python Program
1.12.1 Interactive Mode Programming
1.12.2 The Script Mode Programming
1.13 Python’s Interactive Help
1.13.1 Python Help Through a Web Browser
1.14 Python Differences From Other Languages
1.14.1 Difference Between C and Python
1.14.2 Difference Between C++ and Python
1.14.3 Difference between Java and Python
1.15 Summary
Review Questions
2. Python Data Types and Input Output
2.1 Keywords
2.2 Identifiers
2.3 Python Statements
2.4 Indentation
2.5 Python Documentation
2.5.1 Single Line Comment
2.5.2 Multi Line Comments
2.6 Docstrings
2.7 Variables
2.7.1 Variable Assignment
2.7.2 Variable Types in Python
2.8 Multiple Assignment
2.9 Python Data Types
2.9.1 Numeric Datatype
2.9.1.1 Integers
2.9.1.2 Floating-point Numbers
2.9.1.3 Complex Numbers
2.9.2 Strings
2.9.2.1 Indexing of a String:
2.9.2.2 Negative Indexing:
2.9.2.3 Slicing
2.9.3 Booleans
2.9.4 Lists
2.9.5 Tuples
2.9.6 Sets
2.7.8 Dictionaries
2.10 Data Type Conversion
2.10.1 Implicit Type Conversion in Python
2.10.2 Explicit Type Conversion in Python
2.11 Input and output
2.12 Import
2.13 Summary
Review Questions
3. Operators and Expressions
3.1 Operator
3.1.1 Arithmetic Operators
3.1.2 Comparison Operators
3.1.3 Assignment Operator
3.1.4 Logical Operators
3.1.5 Bitwise Operators
3.1.6 Special Operators
3.1.6.1 Identity Operators
3.1.6.2 Membership Operators
3.2 Expressions
3.2.1 Python Operator Precedence
3.2.2 Associativity
3.2.3 Non-Associative Operators
3.3 Summary
Review Questions
4. Control Structures
4.1 Decision Making Statements
4.1.1 Python if Statement
4.1.2 Python if-else Statement
4.1.3 Python if-elif-else
4.1.4 Python Nested if Statements
4.2 Python Loops
4.2.1 Types of Loops
4.2.2 Python While Loop
4.2.3 The Infinite Loop
4.2.4 Using else with While Loop
4.2.5 Python for Loop
4.2.6 The range() Function
4.2.7 For Loop with else
4.2.8 Nested Loops
4.3 Python Control Statements
4.3.1 Python Break Statement
4.3.2 Python Continue Statement
4.3.3 Python Pass Statement
4.4 Summary
Review Questions
5. Python Native Data Types
5.1 Numbers
5.1.1 Number Type Conversion
5.1.2 Python Mathematical Functions
5.1.3 Python Trigonometric Functions
5.1.4 Python Random Number Functions
5.1.5 Python Mathematical Constants
5.2 Python Lists
5.2.1 Creating a List
5.2.2 Traversing a List
5.2.3 Changing or Adding Elements to a List
5.2.4 List Methods
5.2.5 List Functions
5.2.6 List Comprehension
5.2.7 List Membership Test
5.3 Python Tuples
5.3.1 Creating a Tuple
5.3.2 Unpacking Tuple
5.3.3 Traversing Elements in a Tuple
5.3.3.1 Indexing
5.3.3.2 Negative Indexing
5.3.3.3 Tuple Slicing
5.3.3.4 Changing/Updating a Tuple
5.3.3.5 Deleting a Tuple
5.3.3.6 Python Tuple Methods
5.3.3.7 Python Tuple Functions
5.3.3.8 Advantages of Tuple
5.4 Python Sets
5.4.1 Creating a Set
5.4.2 Changing/Adding Elements to a Set
5.4.3 Removing Elements from a Set
5.4.4 Python Set Operations
5.4.4.1 Set Union
5.4.4.2 Set Intersection
5.4.4.3 Set Difference
5.4.4.4 Set Symmetric Difference
5.4.5 Python Set Methods
5.4.6 The in Operator
5.4.7 Python Set Functions
5.4.8 Frozen Sets
5.5 Python Dictionary
5.5.1 Creating a Dictionary
5.5.2 Accessing a Dictionary
5.5.3 Updating a Dictionary
5.5.4 Removing or Deleting Elements of a Dictionary
5.5.5 Python Dictionary Methods
5.5.6 Python Dictionary Membership Test
5.5.7 Python Dictionary Functions
5.6 Python Strings
5.6.1 Creating a String in Python
5.6.2 Accessing String Characters
5.6.3 Changing or Deleting String Characters
5.6.4 Python String Operations
5.6.4.1 Concatenation
5.6.4.2 Iteration and Membership Test
5.6.5 String Formatting
5.6.6 Python String Built-in Methods
5.7 Summary
Review Questions
6. Python Functions
6.1 Python Functions
6.2 Advantages of Python
6.3 Types of Functions
6.4 Built-in Functions
6.5 Python User Defined Functions
6.5.1 Function Definition
6.5.2 Function Call
6.5.3 Types of Function Arguments(Parameters)
6.5.3.1 Function with No Arguments
6.5.3.2 Function with Required Arguments
6.5.3.3 Function with Arbitrary Length Arguments
6.5.3.4 Function with Keyword Based Arguments
6.5.3.5 Function with Default Arguments
6.6 Python Anonymous Functions
6.6.1 Characteristics of Lambda Form
6.7 Pass by Value vs. Pass by Reference
6.7.1 Pass by Value
6.7.2 Pass by Object Reference
6.8 Recursion
6.8.1 Advantages of Recursion
6.8.2 Disadvantages of Recursion
6.9 Scope and Lifetime of Variables
6.10 Summary
Review Questions
7. Python Modules
7.1 Need of Module
7.2 Module Definition
7.3 Creating a Module
7.4 Importing Module in the Interpreter
7.5 Importing Module in the Another Script
7.6 Importing Modules
7.7 Search Path of Module
7.8 Module Reloading
7.9 The dir() Function
7.10 Standard Modules
7.11 Python Packages
7.12 Summary
Review Questions
8. Exception Handling
8.1 Exception
8.2 Python Built-in Exceptions
8.3 Exception Handling
8.3.1 Try, Except, Else and Finally
8.3.2 Catching Specific Exceptions in Python
8.3.3 try….finally
8.4 Python User Defined Exceptions
8.5 Summary
Review Questions
9. File Management in Python
9.1 Operations on Files
9.1.1 Opening a File
9.1.2 File Modes
9.1.3 File object Attributes
9.1.4 File Encoding
9.1.5 Closing a File
9.2 write() and read() Methods
9.2.1 Writing to a File
9.2.2 Reading from a File
9.3 Python File Methods
9.4 tell() and seek() Methods
9.5 Renaming and Deleting Files
9.5.1 Rename() Method
9.5.2 Remove() Method
9.6 Directories in Python
9.6.1 mkdir() Method
9.6.2 chdir() Method
9.6.3 getcwd() Method
9.6.4 rmdir() Method
9.6.5 listdir() Method
9.7 Python Directory Methods
9.8 Summary
Review Questions
10. Classes and Objects
10.1 Designing Classes
10.2 Creating Objects
10.2.1 Class Variable
10.2.2 Instance Variable
10.3 Types of Methods
10.4 Access Specifiers in Python
10.5 Accessing Attributes
10.6 The Class Program
10.6.1 Using a Class with Input
10.6.2 A Class Program with Computations
10.7 Editing Class Attributes
10.8 Built-in Class Attributes
10.9 Garbage Collection/Destroying Objects
10.10 Summary
Review Questions
11. Inheritance
11.1 Python Single Inheritance
11.2 Python Multiple Inheritance
11.3 Python Multilevel Inheritance
11.4 Method Overriding in Python
11.5 Special Functions in Python
11.6 Summary
Review Questions
12. Python Operator Overloading
12.1 Overloading ‘+’ Operator in Python
12.2 Overloading ‘-’ Operator in Python
12.3 Overloading Bitwise Operators
12.4 Overloading Relational Operators
12.5 Summary
Review Questions
Appendix
Bibliography
This book explores Python's rich history, dynamic features, and its wide-ranging applications in web development, data science, and machine learning. From its installation process to interactive help, readers embark on a journey through Python's unique characteristics and its distinctions from other programming languages. It lays a solid foundation for beginners and seasoned programmers alike. Print edition not for sale in South Asia (India, Sri Lanka, Nepal, Bangladesh, Pakistan or Bhutan) This book explores Python's rich history, dynamic features, and its wide-ranging applications in web development, data science, and machine learning.