Amazon cover image
Image from Amazon.com
Image from Google Jackets

Python programming : a practical approach / Vijay Kumar Sharma, Vimal Kumar, Swati Sharma, Shashwat Pathak.

By: Contributor(s): Material type: TextTextLanguage: English Publication details: UK : CRC Press, 2022.Edition: First editionDescription: 316 pagesISBN:
  • 9781032028491
  • 9781032028521
Subject(s): Additional physical formats: Online version:: Python programmingDDC classification:
  • 005.133 23 SHA
Contents:
Cover Half Title Title Page Copyright Page Dedication Contents List of Figures List of Tables Preface Content and Structure Acknowledgements About the Authors 1 Introduction to Python Programming 1.1 Introduction 1.2 Importance 1.3 Limitations of Python 1.4 Python Impressions 1.5 How to Run Python 1.5.1 From the Command Line 1.5.2 From the Integrated Development Environment (IDLE) 1.6 Internal Working of Python 1.7 Comments in Python 1.8 Conclusion Review Questions Programming Assignments References 2 Basics of Python Programming 2.1 Introduction 2.2 Identifiers 2.2.1 Rules to Declare the Identifier 2.2.2 Characteristics of the Identifier 2.3 Reserved Keywords 2.4 Literals 2.5 Fundamental Data Types 2.5.1 Integer Numbers 2.5.2 Floating Point Numbers 2.5.3 Complex Numbers 2.5.4 Boolean Type 2.5.5 String Type 2.6 Base Conversion 2.7 Type Casting 2.7.1 Integer: Int() 2.7.2 Floating Point: Float() 2.7.3 Complex Numbers: Complex() 2.7.4 Boolean: Bool() 2.7.5 String: Str() 2.7.6 Bytes Data Type: Bytes() 2.7.7 Byte Array Data Type: Bytearray() 2.7.8 List Data Type: List[] 2.7.9 Tuple Data Type: Tuple() 2.7.10 Range Data Type: Range() 2.7.11 Set Data Type: Set{} 2.7.12 Frozenset Data Type: Frozenset() 2.7.13 Dictionary Data Type: Dict{} 2.7.14 None Data Type: None 2.8 Escape Characters 2.9 Input() Function 2.10 Evaluate: Eval() Function 2.11 Command Line Arguments 2.12 Print: Print() Function 2.13 Delete Statement 2.14 Conclusion Review Questions Programming Assignments References 3 Operators in Python 3.1 Introduction 3.2 Operators 3.2.1 Arithmetic Operators 3.2.2 Relational Operators 3.2.3 Logical Operators 3.2.4 Bitwise Operators 3.2.5 Assignment Operators 3.2.6 Ternary Operator or Conditional Operator 3.2.7 Special Operators 3.2.7.1 Identity Operator 3.2.7.2 Membership Operator 3.3 Operator Precedence 3.4 Conclusion Review Questions Programming Assignments References 4 Control Flow in Python 4.1 Introduction 4.2 Conditional Statements 4.2.1 If Statement 4.2.2 If-Else Statement 4.2.3 If-Elif-Else Statement 4.3 Iterative Statements 4.3.1 For Loop 4.3.2 While Loop 4.3.3 Nested Loops 4.4 Transfer Statements 4.4.1 Break Statement 4.4.2 Continue Statement 4.4.3 Pass Statement 4.5 Loops with Else Block 4.6 Conclusion Review Questions Programming Assignments References 5 Strings 5.1 Introduction 5.2 Multiline String Literals 5.3 Accessing Characters of String 5.3.1 By Using Index 5.3.2 By Using Slice Operator 5.3.2.1 Behavior of Slice Operator 5.3.2.2 Slice Operator Case Study 5.4 Mathematical Operators for Strings 5.5 Len() Function 5.6 Checking Membership 5.7 String Operations 5.7.1 Comparison of Strings 5.7.2 Removing Spaces from a String 5.7.3 Finding Sub-strings 5.7.4 Index() 5.7.5 Methods to Count Sub-string in the Main String 5.7.6 Replacing a String with Another String 5.7.7 Splitting of Strings 5.7.8 Method to Join the Strings 5.7.9 Methods to Change the Case of a String 5.7.10 Method to Check the Start and End Part of String 5.7.11 Methods for Checking the Type of Characters 5.8 Formatting of the Strings 5.8.1 Case 1:Formatting (Default, Positional, and Keyword Arguments) 5.8.2 Case 2: Formatting of Numbers 5.8.3 Case 3: Formatting for Signed Numbers 5.8.4 Case 4: Number Formatting with Alignment 5.8.5 Case 5: String Formatting with Format() 5.8.6 Case 6: Truncating Strings Using Format() Method 5.8.7 Case 7: Formatting Dictionary Members Using Format() Method 5.8.8 Case 8: Formatting Class Members Using Format() Method 5.8.9 Case 9: Dynamic Formatting Using Format() 5.8.10 Case 10: Dynamic Float Format Template 5.8.11 Case 11: Formatting Date Values 5.8.12 Case 12: Formatting Complex Numbers 5.9 Conclusion Review Questions Programming Assignments References 6 Data Structures in Python 6.1 Introduction 6.2 List 6.2.1 Creation of List Objects 6.2.1.1 With Dynamic Input 6.2.1.2 With List() Function 6.2.1.3 With Split() Function 6.2.2 Accessing Elements of a List 6.2.2.1 By Using an Index 6.2.2.2 By Using a Slice Operator 6.2.3 List vs Mutability 6.2.4 Traversing the Elements of a List 6.2.4.1 By Using the While Loop 6.2.4.2 By Using the For Loop 6.2.5 Important Functions of a List 6.2.5.1 To Get Information about a List 6.2.5.2 Manipulating Elements of a List 6.2.5.3 Ordering Elements of a List 6.2.6 Aliasing and Cloning of List Objects 6.2.6.1 By Using the Slice Operator 6.2.6.2 By Using the Copy() Function 6.2.7 Using Mathematical Operators for List Objects 6.2.7.1 Concatenation Operator (+) 6.2.7.2 Repetition Operator (*) 6.2.8 Comparing List Objects 6.2.9 Membership Operators 6.2.10 Clear() Function 6.2.11 Nested List 6.2.12 List Comprehensions 6.3 Tuple 6.3.1 Tuple Creation 6.3.2 Accessing Elements of a Tuple 6.3.2.1 By Using the Index 6.3.2.2 By Using the Slice Operator 6.3.3 Tuple vs Immutability 6.3.4 Mathematical Operators for a Tuple 6.3.5 Important Functions of a Tuple 6.3.6 Tuple Packing and Unpacking 6.3.7 Tuple Comprehension 6.4 Set 6.4.1 Creation of Set Objects 6.4.2 Important Functions of a Set 6.4.3 Mathematical Operations on a Set 6.4.4 Set Comprehension 6.5 Dictionary 6.5.1 Creating a Dictionary 6.5.2 Accessing Data from a Dictionary 6.5.3 Updating a Dictionary 6.5.4 Deleting Elements from a Dictionary 6.5.5 Important Functions of a Dictionary 6.5.6 Dictionary Comprehension 6.6 Conclusion Review Questions Programming Assignments References 7 Functions 7.1 Introduction 7.2 Types of Functions 7.2.1 Built-in Functions 7.2.2 User-Defined Functions 7.3 Return Statement 7.4 Arguments in a Function 7.4.1 Positional Arguments 7.4.2 Keyword Arguments 7.4.3 Default Arguments 7.4.4 Variable Length Arguments 7.5 Scope of Variables 7.5.1 Global Variables 7.5.2 Local Variables 7.6 Global Keyword 7.7 Recursive Function 7.8 Lambda Function 7.9 Filter() Function 7.10 Map() Function 7.11 Reduce() Function 7.12 Function Aliasing 7.13 Nested Functions 7.14 Decorator Functions 7.14.1 Calling of a Same Function Using and without Using a Decorator 7.14.2 Decorator Chaining 7.15 Generator Functions 7.16 Conclusion Review Questions Programming Assignments References 8 Modules 8.1 Introduction 8.2 Module Aliasing 8.3 Member Aliasing 8.4 Reloading a Module 8.5 Dir() Function 8.6 Math Module 8.7 Random Module 8.8 Packages 8.9 Conclusion Review Questions Programming Assignments References 9 Basic Concepts of Object-Oriented Programming 9.1 Introduction 9.2 Class 9.3 Object 9.4 Self Variable 9.5 Constructor 9.6 Types of Variables 9.6.1 Instance Variables 9.6.1.1 Declaring Instance Variables 9.6.1.2 Accessing Instance Variables 9.6.1.3 Deleting Instance Variables 9.6.2 Static Variables 9.6.2.1 Declaration of Static Variables 9.6.2.2 Accessing Static Variables 9.6.2.3 Deleting Static Variables 9.6.3 Local Variables 9.7 Types of Methods 9.7.1 Instance Methods 9.7.2 Class Methods 9.7.3 Static Methods 9.8 Setter and Getter Methods 9.9 Passing Members of One Class to Other Class 9.10 Conclusion Review Questions Programming Assignments References 10 Advanced Concepts of Object-Oriented Programming 10.1 Introduction 10.2 Inner Class 10.3 Garbage Collection 10.4 Destructor 10.5 Finding the Number of References of an Object 10.6 Encapsulation 10.7 Inheritance 10.7.1 By Composition (HAS-A Relationship) 10.7.2 By Inheritance (IS-A Relationship) 10.8 Aggregation vs Composition 10.9 Inheritance 10.9.1 Single Inheritance 10.9.2 Multilevel Inheritance 10.9.3 Hierarchical Inheritance 10.9.4 Multiple Inheritances 10.9.5 Hybrid Inheritance 10.9.6 Cyclic Inheritance 10.10 Method Resolution Order (MRO) 10.11 Super() Method 10.11.1 Calling Method of a Specific Super Class 10.12 Polymorphism 10.12.1 Duck Typing Philosophy 10.12.2 Overloading 10.12.2.1 Operator Overloading 10.12.2.2 Method Overloading 10.12.2.3 Constructor Overloading 10.12.3 Overriding 10.12.3.1 Method Overriding 10.13 Abstract Class 10.14 Abstract Method 10.15 Interface 10.15.1 Concrete Class vs Abstract Class vs Interface 10.15.2 Public, Protected, and Private Attributes 10.16 __str__() Method 10.17 Conclusion Review Questions Programming Assignments References 11 Exception Handling 11.1 Introduction 11.2 Types of Error 11.3 Exception 11.4 Default Exception Handling 11.5 Customized Exception Handling: Using Try-Except 11.6 Multiple Except Blocks 11.6.1 Multiple Exceptions in a Single Except Block 11.6.2 Default Except Block 11.7 The Finally Block 11.7.1 Control Flow in Try-Except-Finally 11.8 Nested Try-Except-Finally Block 11.8.1 Control Flow in Nested Try-Except-Finally Block 11.8.2 Else Block with Try-Except-Finally 11.9 Types of Exception 11.10 Raise User-Defined Exception 11.11 Assertion 11.12 Conclusion Review Questions Programming Assignments References 12 File Handling 12.1 Introduction 12.1.1 Opening and Closing a File 12.1.2 Attributes of a File Object 12.1.3 Writing and Reading Data to Text Files 12.2 With Statement 12.3 The Seek() and Tell() Methods 12.3.1 Tell() Method 12.3.2 Seek() Method 12.4 Testing the Existence of a File 12.5 Handling Binary Data 12.6 Handling CSV Files 12.6.1 Writing Data to a CSV File 12.6.2 Reading Data from a CSV File 12.7 Zipping and Unzipping Files 12.7.1 To Create a Zip File 12.7.2 To Perform Unzip Operations 12.8 Directory 12.8.1 Operations on a Directory 12.9 To Get Information about a File 12.9.1 Displaying Statistics of a File 12.9.2 To Print Specified Properties 12.10 Pickling and Unpickling of Objects 12.10.1 Reading and Writing the State-of-Objects 12.10.2 Writing Multiple Objects 12.11 Conclusion Review Questions Programming Assignments 13 Multithreading 13.1 Introduction 13.2 Ways of Creating a Thread 13.2.1 Creation of a Thread without Using any Class 13.2.2 Creation of a Thread by Extending the Thread Class 13.2.3 Creation of a Thread without Extending the Thread Class 13.3 Setting and Getting Name of a Thread 13.4 Thread Identification Number 13.5 Active_count() Function 13.6 Enumerate Function 13.7 IsAlive() Method 13.8 Join() Method 13.9 Daemon Thread 13.10 Conclusion Review Questions Programming Assignments Reference 14 Synchronization 14.1 Introduction 14.1.1 By Using the Lock Concept 14.1.2 By Using RLock 14.1.3 By Using Semaphore 14.2 Inter-Thread Communication 14.2.1 By Using Event Objects 14.2.2 By Using a Condition Object 14.2.3 By Using Queue 14.3 Variants of Queues 14.3.1 First-In-First-Out Queue 14.3.2 Last-In-First-Out Queue 14.3.3 Priority Queue 14.4 Usage of Locks 14.5 Conclusion Review Questions Programming Assignments References 15 Regular Expressions and Web Scraping 15.1 Introduction 15.1.1 Character Classes 15.1.2 Pre-defined Character Classes 15.1.3 Quantifiers 15.2 Functions of Re Module 15.2.1 Match() 15.2.2 Fullmatch() 15.2.3 Search() 15.2.4 Findall() 15.2.5 Finditer() 15.2.6 Sub() 15.2.7 Subn() 15.2.8 Split() 15.2.9 ^ Symbol 15.2.10 $ Symbol 15.3 Web Scraping 15.4 Conclusion Review Questions Programming Assignment References 16 Database Programming 16.1 Introduction 16.2 File System 16.3 Database 16.3.1 Python Database Programming 16.3.2 Working with the Oracle Database 16.3.3 Working with the MySQL Database 16.4 Conclusion Review Questions Programming Assignments Reference Appendix A: Mini Projects Appendix B: Socket Programming in Python Appendix C: Parallel Processing in Python Index
Summary: Python Programming A Practical Approach Maintaining a practical perspective, Python Programming: A Practical Approach acquaints you with the wonderful world of programming. The book is a starting point for those who want to learn Python programming. The backbone of any programming, which is the data structure and components such as strings, lists, etc., have been illustrated with many examples and enough practice problems to instill a level of self-confidence in the reader. Drawing on knowledge gained directly from teaching Computer Science as a subject and working on a wide range of projects related to ML, AI, deep learning, and blockchain, the authors have tried their best to present the necessary skills for a Python programmer. Once the foundation of Python programming is built and the readers are aware of the exact structure, dimensions, processing, building blocks, and representation of data, they can readily take up their specific problems from the area of interest and solve them with the help of Python. These include, but are not limited to, operators, control flow, strings, functions, module processing, object-oriented programming, exception and file handling, multithreading, synchronization, regular expressions, and Python database programming. This book on Python programming is specially designed to keep readers busy with learning fundamentals and generates a sense of confidence by attempting the assignment problems. We firmly believe that explaining any particular technology deviates from learning the fundamentals of a programming language. This book is focused on helping readers attempt implementation in their areas of interest through the skills imparted through this book. We have attempted to present the real essence of Python programming, which you can confidently apply in real life by using Python as a tool. Salient Features Based on real-world requirements and solution. Simple presentation without avoiding necessary details of the topic. Executable programs on almost every topic. Plenty of exercise questions, designed to test readers’ skills and understanding. Purposefully designed to be instantly applicable, Python Programming: A Practical Approach provides implementation examples so that the described subject matter can be immediately implemented due to the well-known versatility of Python in handling different data types with ease.
Tags from this library: No tags from this library for this title. Log in to add tags.
Star ratings
    Average rating: 0.0 (0 votes)
Holdings
Item type Current library Collection Call number Status Barcode
General Books General Books CUTN Central Library Generalia Non-fiction 005.133 SHA (Browse shelf(Opens below)) Available 51778

Includes bibliographical references and index.

Cover
Half Title
Title Page
Copyright Page
Dedication
Contents
List of Figures
List of Tables
Preface
Content and Structure
Acknowledgements
About the Authors
1 Introduction to Python Programming
1.1 Introduction
1.2 Importance
1.3 Limitations of Python
1.4 Python Impressions
1.5 How to Run Python
1.5.1 From the Command Line
1.5.2 From the Integrated Development Environment (IDLE)
1.6 Internal Working of Python
1.7 Comments in Python
1.8 Conclusion
Review Questions
Programming Assignments
References
2 Basics of Python Programming
2.1 Introduction
2.2 Identifiers
2.2.1 Rules to Declare the Identifier
2.2.2 Characteristics of the Identifier
2.3 Reserved Keywords
2.4 Literals
2.5 Fundamental Data Types
2.5.1 Integer Numbers
2.5.2 Floating Point Numbers
2.5.3 Complex Numbers
2.5.4 Boolean Type
2.5.5 String Type
2.6 Base Conversion
2.7 Type Casting
2.7.1 Integer: Int()
2.7.2 Floating Point: Float()
2.7.3 Complex Numbers: Complex()
2.7.4 Boolean: Bool()
2.7.5 String: Str()
2.7.6 Bytes Data Type: Bytes()
2.7.7 Byte Array Data Type: Bytearray()
2.7.8 List Data Type: List[]
2.7.9 Tuple Data Type: Tuple()
2.7.10 Range Data Type: Range()
2.7.11 Set Data Type: Set{}
2.7.12 Frozenset Data Type: Frozenset()
2.7.13 Dictionary Data Type: Dict{}
2.7.14 None Data Type: None
2.8 Escape Characters
2.9 Input() Function
2.10 Evaluate: Eval() Function
2.11 Command Line Arguments
2.12 Print: Print() Function
2.13 Delete Statement
2.14 Conclusion
Review Questions
Programming Assignments
References
3 Operators in Python
3.1 Introduction
3.2 Operators
3.2.1 Arithmetic Operators
3.2.2 Relational Operators
3.2.3 Logical Operators
3.2.4 Bitwise Operators
3.2.5 Assignment Operators
3.2.6 Ternary Operator or Conditional Operator
3.2.7 Special Operators
3.2.7.1 Identity Operator
3.2.7.2 Membership Operator
3.3 Operator Precedence
3.4 Conclusion
Review Questions
Programming Assignments
References
4 Control Flow in Python
4.1 Introduction
4.2 Conditional Statements
4.2.1 If Statement
4.2.2 If-Else Statement
4.2.3 If-Elif-Else Statement
4.3 Iterative Statements
4.3.1 For Loop
4.3.2 While Loop
4.3.3 Nested Loops
4.4 Transfer Statements
4.4.1 Break Statement
4.4.2 Continue Statement
4.4.3 Pass Statement
4.5 Loops with Else Block
4.6 Conclusion
Review Questions
Programming Assignments
References
5 Strings
5.1 Introduction
5.2 Multiline String Literals
5.3 Accessing Characters of String
5.3.1 By Using Index
5.3.2 By Using Slice Operator
5.3.2.1 Behavior of Slice Operator
5.3.2.2 Slice Operator Case Study
5.4 Mathematical Operators for Strings
5.5 Len() Function
5.6 Checking Membership
5.7 String Operations
5.7.1 Comparison of Strings
5.7.2 Removing Spaces from a String
5.7.3 Finding Sub-strings
5.7.4 Index()
5.7.5 Methods to Count Sub-string in the Main String
5.7.6 Replacing a String with Another String
5.7.7 Splitting of Strings
5.7.8 Method to Join the Strings
5.7.9 Methods to Change the Case of a String
5.7.10 Method to Check the Start and End Part of String
5.7.11 Methods for Checking the Type of Characters
5.8 Formatting of the Strings
5.8.1 Case 1:Formatting (Default, Positional, and Keyword Arguments)
5.8.2 Case 2: Formatting of Numbers
5.8.3 Case 3: Formatting for Signed Numbers
5.8.4 Case 4: Number Formatting with Alignment
5.8.5 Case 5: String Formatting with Format()
5.8.6 Case 6: Truncating Strings Using Format() Method
5.8.7 Case 7: Formatting Dictionary Members Using Format() Method
5.8.8 Case 8: Formatting Class Members Using Format() Method
5.8.9 Case 9: Dynamic Formatting Using Format()
5.8.10 Case 10: Dynamic Float Format Template
5.8.11 Case 11: Formatting Date Values
5.8.12 Case 12: Formatting Complex Numbers
5.9 Conclusion
Review Questions
Programming Assignments
References
6 Data Structures in Python
6.1 Introduction
6.2 List
6.2.1 Creation of List Objects
6.2.1.1 With Dynamic Input
6.2.1.2 With List() Function
6.2.1.3 With Split() Function
6.2.2 Accessing Elements of a List
6.2.2.1 By Using an Index
6.2.2.2 By Using a Slice Operator
6.2.3 List vs Mutability
6.2.4 Traversing the Elements of a List
6.2.4.1 By Using the While Loop
6.2.4.2 By Using the For Loop
6.2.5 Important Functions of a List
6.2.5.1 To Get Information about a List
6.2.5.2 Manipulating Elements of a List
6.2.5.3 Ordering Elements of a List
6.2.6 Aliasing and Cloning of List Objects
6.2.6.1 By Using the Slice Operator
6.2.6.2 By Using the Copy() Function
6.2.7 Using Mathematical Operators for List Objects
6.2.7.1 Concatenation Operator (+)
6.2.7.2 Repetition Operator (*)
6.2.8 Comparing List Objects
6.2.9 Membership Operators
6.2.10 Clear() Function
6.2.11 Nested List
6.2.12 List Comprehensions
6.3 Tuple
6.3.1 Tuple Creation
6.3.2 Accessing Elements of a Tuple
6.3.2.1 By Using the Index
6.3.2.2 By Using the Slice Operator
6.3.3 Tuple vs Immutability
6.3.4 Mathematical Operators for a Tuple
6.3.5 Important Functions of a Tuple
6.3.6 Tuple Packing and Unpacking
6.3.7 Tuple Comprehension
6.4 Set
6.4.1 Creation of Set Objects
6.4.2 Important Functions of a Set
6.4.3 Mathematical Operations on a Set
6.4.4 Set Comprehension
6.5 Dictionary
6.5.1 Creating a Dictionary
6.5.2 Accessing Data from a Dictionary
6.5.3 Updating a Dictionary
6.5.4 Deleting Elements from a Dictionary
6.5.5 Important Functions of a Dictionary
6.5.6 Dictionary Comprehension
6.6 Conclusion
Review Questions
Programming Assignments
References
7 Functions
7.1 Introduction
7.2 Types of Functions
7.2.1 Built-in Functions
7.2.2 User-Defined Functions
7.3 Return Statement
7.4 Arguments in a Function
7.4.1 Positional Arguments
7.4.2 Keyword Arguments
7.4.3 Default Arguments
7.4.4 Variable Length Arguments
7.5 Scope of Variables
7.5.1 Global Variables
7.5.2 Local Variables
7.6 Global Keyword
7.7 Recursive Function
7.8 Lambda Function
7.9 Filter() Function
7.10 Map() Function
7.11 Reduce() Function
7.12 Function Aliasing
7.13 Nested Functions
7.14 Decorator Functions
7.14.1 Calling of a Same Function Using and without Using a Decorator
7.14.2 Decorator Chaining
7.15 Generator Functions
7.16 Conclusion
Review Questions
Programming Assignments
References
8 Modules
8.1 Introduction
8.2 Module Aliasing
8.3 Member Aliasing
8.4 Reloading a Module
8.5 Dir() Function
8.6 Math Module
8.7 Random Module
8.8 Packages
8.9 Conclusion
Review Questions
Programming Assignments
References
9 Basic Concepts of Object-Oriented Programming
9.1 Introduction
9.2 Class
9.3 Object
9.4 Self Variable
9.5 Constructor
9.6 Types of Variables
9.6.1 Instance Variables
9.6.1.1 Declaring Instance Variables
9.6.1.2 Accessing Instance Variables
9.6.1.3 Deleting Instance Variables
9.6.2 Static Variables
9.6.2.1 Declaration of Static Variables
9.6.2.2 Accessing Static Variables
9.6.2.3 Deleting Static Variables
9.6.3 Local Variables
9.7 Types of Methods
9.7.1 Instance Methods
9.7.2 Class Methods
9.7.3 Static Methods
9.8 Setter and Getter Methods
9.9 Passing Members of One Class to Other Class
9.10 Conclusion
Review Questions
Programming Assignments
References
10 Advanced Concepts of Object-Oriented Programming
10.1 Introduction
10.2 Inner Class
10.3 Garbage Collection
10.4 Destructor
10.5 Finding the Number of References of an Object
10.6 Encapsulation
10.7 Inheritance
10.7.1 By Composition (HAS-A Relationship)
10.7.2 By Inheritance (IS-A Relationship)
10.8 Aggregation vs Composition
10.9 Inheritance
10.9.1 Single Inheritance
10.9.2 Multilevel Inheritance
10.9.3 Hierarchical Inheritance
10.9.4 Multiple Inheritances
10.9.5 Hybrid Inheritance
10.9.6 Cyclic Inheritance
10.10 Method Resolution Order (MRO)
10.11 Super() Method
10.11.1 Calling Method of a Specific Super Class
10.12 Polymorphism
10.12.1 Duck Typing Philosophy
10.12.2 Overloading
10.12.2.1 Operator Overloading
10.12.2.2 Method Overloading
10.12.2.3 Constructor Overloading
10.12.3 Overriding
10.12.3.1 Method Overriding
10.13 Abstract Class
10.14 Abstract Method
10.15 Interface
10.15.1 Concrete Class vs Abstract Class vs Interface
10.15.2 Public, Protected, and Private Attributes
10.16 __str__() Method
10.17 Conclusion
Review Questions
Programming Assignments
References
11 Exception Handling
11.1 Introduction
11.2 Types of Error
11.3 Exception
11.4 Default Exception Handling
11.5 Customized Exception Handling: Using Try-Except
11.6 Multiple Except Blocks
11.6.1 Multiple Exceptions in a Single Except Block
11.6.2 Default Except Block
11.7 The Finally Block
11.7.1 Control Flow in Try-Except-Finally
11.8 Nested Try-Except-Finally Block
11.8.1 Control Flow in Nested Try-Except-Finally Block
11.8.2 Else Block with Try-Except-Finally
11.9 Types of Exception
11.10 Raise User-Defined Exception
11.11 Assertion
11.12 Conclusion
Review Questions
Programming Assignments
References
12 File Handling
12.1 Introduction
12.1.1 Opening and Closing a File
12.1.2 Attributes of a File Object
12.1.3 Writing and Reading Data to Text Files
12.2 With Statement
12.3 The Seek() and Tell() Methods
12.3.1 Tell() Method
12.3.2 Seek() Method
12.4 Testing the Existence of a File
12.5 Handling Binary Data
12.6 Handling CSV Files
12.6.1 Writing Data to a CSV File
12.6.2 Reading Data from a CSV File
12.7 Zipping and Unzipping Files
12.7.1 To Create a Zip File
12.7.2 To Perform Unzip Operations
12.8 Directory
12.8.1 Operations on a Directory
12.9 To Get Information about a File
12.9.1 Displaying Statistics of a File
12.9.2 To Print Specified Properties
12.10 Pickling and Unpickling of Objects
12.10.1 Reading and Writing the State-of-Objects
12.10.2 Writing Multiple Objects
12.11 Conclusion
Review Questions
Programming Assignments
13 Multithreading
13.1 Introduction
13.2 Ways of Creating a Thread
13.2.1 Creation of a Thread without Using any Class
13.2.2 Creation of a Thread by Extending the Thread Class
13.2.3 Creation of a Thread without Extending the Thread Class
13.3 Setting and Getting Name of a Thread
13.4 Thread Identification Number
13.5 Active_count() Function
13.6 Enumerate Function
13.7 IsAlive() Method
13.8 Join() Method
13.9 Daemon Thread
13.10 Conclusion
Review Questions
Programming Assignments
Reference
14 Synchronization
14.1 Introduction
14.1.1 By Using the Lock Concept
14.1.2 By Using RLock
14.1.3 By Using Semaphore
14.2 Inter-Thread Communication
14.2.1 By Using Event Objects
14.2.2 By Using a Condition Object
14.2.3 By Using Queue
14.3 Variants of Queues
14.3.1 First-In-First-Out Queue
14.3.2 Last-In-First-Out Queue
14.3.3 Priority Queue
14.4 Usage of Locks
14.5 Conclusion
Review Questions
Programming Assignments
References
15 Regular Expressions and Web Scraping
15.1 Introduction
15.1.1 Character Classes
15.1.2 Pre-defined Character Classes
15.1.3 Quantifiers
15.2 Functions of Re Module
15.2.1 Match()
15.2.2 Fullmatch()
15.2.3 Search()
15.2.4 Findall()
15.2.5 Finditer()
15.2.6 Sub()
15.2.7 Subn()
15.2.8 Split()
15.2.9 ^ Symbol
15.2.10 $ Symbol
15.3 Web Scraping
15.4 Conclusion
Review Questions
Programming Assignment
References
16 Database Programming
16.1 Introduction
16.2 File System
16.3 Database
16.3.1 Python Database Programming
16.3.2 Working with the Oracle Database
16.3.3 Working with the MySQL Database
16.4 Conclusion
Review Questions
Programming Assignments
Reference
Appendix A: Mini Projects
Appendix B: Socket Programming in Python
Appendix C: Parallel Processing in Python
Index

Python Programming
A Practical Approach
Maintaining a practical perspective, Python Programming: A Practical Approach acquaints you with the wonderful world of programming. The book is a starting point for those who want to learn Python programming. The backbone of any programming, which is the data structure and components such as strings, lists, etc., have been illustrated with many examples and enough practice problems to instill a level of self-confidence in the reader. Drawing on knowledge gained directly from teaching Computer Science as a subject and working on a wide range of projects related to ML, AI, deep learning, and blockchain, the authors have tried their best to present the necessary skills for a Python programmer. Once the foundation of Python programming is built and the readers are aware of the exact structure, dimensions, processing, building blocks, and representation of data, they can readily take up their specific problems from the area of interest and solve them with the help of Python. These include, but are not limited to, operators, control flow, strings, functions, module processing, object-oriented programming, exception and file handling, multithreading, synchronization, regular expressions, and Python database programming. This book on Python programming is specially designed to keep readers busy with learning fundamentals and generates a sense of confidence by attempting the assignment problems. We firmly believe that explaining any particular technology deviates from learning the fundamentals of a programming language. This book is focused on helping readers attempt implementation in their areas of interest through the skills imparted through this book. We have attempted to present the real essence of Python programming, which you can confidently apply in real life by using Python as a tool. Salient Features Based on real-world requirements and solution. Simple presentation without avoiding necessary details of the topic. Executable programs on almost every topic. Plenty of exercise questions, designed to test readers’ skills and understanding. Purposefully designed to be instantly applicable, Python Programming: A Practical Approach provides implementation examples so that the described subject matter can be immediately implemented due to the well-known versatility of Python in handling different data types with ease.

There are no comments on this title.

to post a comment.