وبلاگ بلیان

Python basics : [a self-teaching introduction

معرفی کتاب «Python basics : [a self-teaching introduction» نوشتهٔ Bhasin, Harsh، منتشرشده توسط نشر Mercury Learning and Information در سال 2019. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است. «Python basics : [a self-teaching introduction» در دستهٔ بدون دسته‌بندی قرار دارد.

This Book Is Designed For Use As A Primary Introduction To Python And Can Be Used As An Introductory Text Or As A Resource For Professionals In Industry. The Book Has Been Divided Into Four Sections. The First Section Deals With The Language Fundamentals, Primarily The Procedural Part Of The Language, The Second Introduces The Object-oriented Paradigms, The Third Section Deals With Data Structures, And The Last Is Devoted To Advanced Topics Like Handling Multi-dimensional Arrays Using Numpy And Visualization Using Matplotlib. Regular Expressions And Multi-threading Have Been Introduced In The Appendices. Features - Includes Sections Dedicated To Data Structures - Offers In-depth Treatment Of Topics Such As Classes, Inheritance, Bst, And Numpy - Introduces Topics Like Matplotlib And Pil - Contains Exercises For Practice And A Review Of Essential Programming Concepts Title Page 4 Copyright 5 Dedication 6 Contents 7 Chapter 1: Introduction to Python 16 1.1 Introduction 16 1.2 Features of Python 17 1.2.1 Easy 18 1.2.2 Type and Run 18 1.2.3 Syntax 18 1.2.4 Mixing 18 1.2.5 Dynamic Typing 19 1.2.6 Built in Object Types 19 1.2.7 Numerous Libraries and Tools 19 1.2.8 Portable 19 1.2.9 Free 19 1.3 The Paradigms 20 1.3.1 Procedural 20 1.3.2 Object-Oriented 20 1.3.3 Functional 20 1.4 Chronology and Uses 20 1.4.1 Chronology 20 1.4.2 Uses 21 1.5 Installation of Anaconda 22 1.6 Conclusion 27 Chapter 2: Python Objects 33 2.1 Introduction 33 2.2 Basic Data Types Revisited 36 2.2.1 Fractions 39 2.3 Strings 40 2.4 Lists and Tuples 44 2.4.1 List 44 2.4.2 Tuples 45 2.4.3 Features of Tuples 47 2.5 Conclusion 47 Chapter 3: Conditional Statements 54 3.1 Introduction 54 3.2 if, if-else, and if-elif-else constructs 55 3.3 The if-elif-else Ladder 61 3.4 Logical Operators 62 3.5 The Ternary Operator 64 3.6 The get Construct 65 3.7 Examples 67 3.8 Conclusion 71 Chapter 4: Looping 79 4.1 Introduction 79 4.2 While 81 4.3 Patterns 85 4.4 Nesting and Applications of Loops in Lists 91 4.5 Conclusion 96 Chapter 5: Functions 102 5.1 Introduction 102 5.2 Features of a Function 103 5.2.1 Modular Programming 103 5.2.2 Reusability of Code 103 5.2.3 Manageability 103 5.3 Basic Terminology 104 5.3.1 Name of a Function 104 5.3.2 Arguments 104 5.3.3 Return Value 104 5.4 Definition and Invocation 104 5.4.1 Working 106 5.5 Types of Function 108 5.5.1 Advantage of Arguments 110 5.6 Implementing Search 111 5.7 Scope 112 5.8 Recursion 114 5.8.1 Rabbit Problem 115 5.8.2 Disadvantages of Using Recursion 118 5.9 Conclusion 118 Chapter 6: Iterations, Generators, and Comprehensions 128 6.1 Introduction 128 6.2 The Power of “For” 129 6.3 Iterators 132 6.4 Defining an Iterable Object 134 6.5 Generators 135 6.6 Comprehensions 141 6.7 Conclusion 145 Chapter 7: File Handling 151 7.1 Introduction 151 7.2 The File Handling Mechanism 152 7.3 The Open Function and File Access Modes 153 7.4 Python Functions for File Handling 155 7.4.1 The Essential Ones 155 7.4.2 The OS Methods 157 7.4.3 Miscellaneous Functions and File Attributes 157 7.5 Command Line Arguments 159 7.6 Implementation and Illustrations 160 7.7 Conclusion 166 Chapter 8: Strings 174 8.1 Introduction 174 8.2 The Use of “For” and “While” 175 8.3 String Operators 178 8.3.1 The Concatenation Operator (+) 178 8.3.2 The Replication Operator 179 8.3.3 The Membership Operator 179 8.4 Functions for String Handling 180 8.4.1 len() 181 8.4.2 Capitalize() 181 8.4.3 find() 182 8.4.4 count 182 8.4.5 Endswith() 183 8.4.6 Encode 183 8.4.7 Decode 183 8.4.8 Miscellaneous Functions 184 8.5 Conclusion 186 Chapter 9: Introduction to Object Oriented Paradigm 194 9.1 Introduction 194 9.2 Creating New Types 196 9.3 Attributes and Functions 197 9.3.1 Attributes 197 9.3.2 Functions 198 9.4 Elements of Object-Oriented Programming 201 9.4.1 Class 201 9.4.2 Object 202 9.4.3 Encapsulation 203 9.4.4 Data Hiding 203 9.4.5 Inheritance 204 9.4.6 Polymorphism 205 9.4.7 Reusability 205 9.5 Conclusion 205 Chapter 10: Classes and Objects 214 10.1 Introduction to Classes 214 10.2 Defining a Class 215 10.3 Creating an Object 216 10.4 Scope of Data Members 217 10.5 Nesting 220 10.6 Constructor 221 10.7 Constructor Overloading 223 10.8 Destructors 226 10.9 Conclusion 228 Chapter 11: Inheritance 237 11.1 Introduction to Inheritance and Composition 237 11.1.1 Inheritance and Methods 238 11.1.2 Composition 242 11.2 Inheritance: Importance and Types 247 11.2.1 Need for Inheritance 249 11.2.2 Types of Inheritance 250 11.3 Methods 260 11.3.1 Bound Methods 261 11.3.2 Unbound Method 262 11.3.3 Methods are Callable Objects 264 11.3.4 The Importance and Usage of Super 265 11.3.5 Calling the Base Class Function Using Super 266 11.4 Search in Inheritance Tree 267 11.5 Class Interface and Abstract Classes 269 11.6 Conclusion 272 Chapter 12: Operator Overloading 280 12.1 Introduction 280 12.2 _init_ Revisited 281 12.2.1 Overloading _init_ (sort of) 283 12.3 Methods for Overloading Binary Operators 285 12.4 Overloading Binary Operators: The Fraction Example 285 12.5 Overloading the += Operator 291 12.6 Overloading the > and < Operators 293 12.7 Overloading the _boolEan_ Operators: Precedence of _bool_over _len_ 294 12.8 Destructors 297 12.9 Conclusion 299 Chapter 13: Exception Handling 306 13.1 Introduction 306 13.2 Importance and Mechanism 308 13.2.1 An Example of Try/Catch 309 13.2.2 Manually Raising Exceptions 310 13.3 Built-In Exceptions in Python 310 13.4 The Process 312 13.4.1 Exception Handling: Try/Except 313 13.4.2 Raising Exceptions 314 13.5 Crafting User Defined Exceptions 315 13.6 An Example of Exception Handling 316 13.7 Conclusion 321 Chapter 14: Introduction to Data Structures 327 14.1 Introduction 327 14.2 Abstract Data Type 330 14.3 Algorithms 332 14.4 Arrays 333 14.5 Iterative and Recursive Algorithms 339 14.5.1 Iterative Algorithms 340 14.5.2 Recursive Algorithms 343 14.6 Conclusion 346 Chapter 15: Stacks and Queues 354 15.1 Introduction 354 15.2 Stack 355 15.3 Dynamic Implementation of Stacks 358 15.4 Dynamic Implementation: Another Way 360 15.5 Applications of Stacks 361 15.5.1 Reversing a String 361 15.5.2 Infix, Prefix, and Postfix Expressions 363 15.6 Queue 366 15.7 Conclusion 371 Chapter 16: Linked Lists 378 16.1 Introduction 378 16.2 Operations 380 16.3 Implementing Stack Using a Linked List 390 16.4 Queue Using a Linked List 394 16.5 Conclusion 397 Chapter 17: Binary Search Trees 403 17.1 Introduction 403 17.2 Definition and Terminology 404 17.2.1 Graphs: Definition and Representation 404 17.2.2 Trees: Definition, Classification, and Representation 405 17.2.3 Representation of a Binary Tree 407 17.2.4 Tree Traversal: In-order, Pre-order, and Post-order 409 17.3 Binary Search Tree 411 17.3.1 Creation and Insertion 412 17.3.2 Traversal 417 17.3.3 Maximum and Minimum Elements 420 17.4 Conclusion 422 Chapter 18: Introduction to NUMPY 429 18.1 Introduction 429 18.2 Introduction to NumPy and Creation of a Basic Array 430 18.3 Functions for Generating Sequences 433 18.3.1 arange() 433 18.3.2 linspace() 434 18.3.3 logspace() 435 18.4 Aggregate Functions 435 18.5 Broadcasting 440 18.6 Structured Arrays 445 18.7 Conclusion 447 Chapter 19: Introduction to MATPLOTLIB 455 19.1 Introduction 455 19.2 The Plot Function 456 19.3 Subplots 466 19.4 3 Dimensional Plotting 471 19.5 Conclusion 477 Chapter 20: Introduction to Image Processing 483 20.1 Introduction 483 20.2 Opening, Reading, and Writing an Image 484 20.2.1 Opening an Image 485 20.2.2 Reading 485 20.2.3 Writing an Image to a File 486 20.2.4 Displaying an Image 486 20.3 The Contour Function 488 20.4 Clipping 489 20.5 Statistical Information of an Image 490 20.6 Basic Transformation 491 20.6.1 Translation 491 20.6.2 Rotation 493 20.6.3 Scaling 495 20.7 Conclusion 497 Appendix A: Multithreading in Python 503 Appendix B: Regular Expressions 510 Appendix C: Exercises for Practice: Programming Questions 520 Appendix D: Problems for Practice: Multiple Choice Questions 532 Appendix E: Answer to the Multiple Choice Questions 544 Bibliography 553 Index 557 Title Page......Page 4 Copyright......Page 5 Dedication......Page 6 Contents......Page 7 1.1 Introduction......Page 16 1.2 Features of Python......Page 17 1.2.4 Mixing......Page 18 1.2.9 Free......Page 19 1.4.1 Chronology......Page 20 1.4.2 Uses......Page 21 1.5 Installation of Anaconda......Page 22 1.6 Conclusion......Page 27 2.1 Introduction......Page 33 2.2 Basic Data Types Revisited......Page 36 2.2.1 Fractions......Page 39 2.3 Strings......Page 40 2.4.1 List......Page 44 2.4.2 Tuples......Page 45 2.5 Conclusion......Page 47 3.1 Introduction......Page 54 3.2 if, if-else, and if-elif-else constructs......Page 55 3.3 The if-elif-else Ladder......Page 61 3.4 Logical Operators......Page 62 3.5 The Ternary Operator......Page 64 3.6 The get Construct......Page 65 3.7 Examples......Page 67 3.8 Conclusion......Page 71 4.1 Introduction......Page 79 4.2 While......Page 81 4.3 Patterns......Page 85 4.4 Nesting and Applications of Loops in Lists......Page 91 4.5 Conclusion......Page 96 5.1 Introduction......Page 102 5.2.3 Manageability......Page 103 5.4 Definition and Invocation......Page 104 5.4.1 Working......Page 106 5.5 Types of Function......Page 108 5.5.1 Advantage of Arguments......Page 110 5.6 Implementing Search......Page 111 5.7 Scope......Page 112 5.8 Recursion......Page 114 5.8.1 Rabbit Problem......Page 115 5.9 Conclusion......Page 118 6.1 Introduction......Page 128 6.2 The Power of “For”......Page 129 6.3 Iterators......Page 132 6.4 Defining an Iterable Object......Page 134 6.5 Generators......Page 135 6.6 Comprehensions......Page 141 6.7 Conclusion......Page 145 7.1 Introduction......Page 151 7.2 The File Handling Mechanism......Page 152 7.3 The Open Function and File Access Modes......Page 153 7.4.1 The Essential Ones......Page 155 7.4.3 Miscellaneous Functions and File Attributes......Page 157 7.5 Command Line Arguments......Page 159 7.6 Implementation and Illustrations......Page 160 7.7 Conclusion......Page 166 8.1 Introduction......Page 174 8.2 The Use of “For” and “While”......Page 175 8.3.1 The Concatenation Operator (+)......Page 178 8.3.3 The Membership Operator......Page 179 8.4 Functions for String Handling......Page 180 8.4.2 Capitalize()......Page 181 8.4.4 count......Page 182 8.4.7 Decode......Page 183 8.4.8 Miscellaneous Functions......Page 184 8.5 Conclusion......Page 186 9.1 Introduction......Page 194 9.2 Creating New Types......Page 196 9.3.1 Attributes......Page 197 9.3.2 Functions......Page 198 9.4.1 Class......Page 201 9.4.2 Object......Page 202 9.4.4 Data Hiding......Page 203 9.4.5 Inheritance......Page 204 9.5 Conclusion......Page 205 10.1 Introduction to Classes......Page 214 10.2 Defining a Class......Page 215 10.3 Creating an Object......Page 216 10.4 Scope of Data Members......Page 217 10.5 Nesting......Page 220 10.6 Constructor......Page 221 10.7 Constructor Overloading......Page 223 10.8 Destructors......Page 226 10.9 Conclusion......Page 228 11.1 Introduction to Inheritance and Composition......Page 237 11.1.1 Inheritance and Methods......Page 238 11.1.2 Composition......Page 242 11.2 Inheritance: Importance and Types......Page 247 11.2.1 Need for Inheritance......Page 249 11.2.2 Types of Inheritance......Page 250 11.3 Methods......Page 260 11.3.1 Bound Methods......Page 261 11.3.2 Unbound Method......Page 262 11.3.3 Methods are Callable Objects......Page 264 11.3.4 The Importance and Usage of Super......Page 265 11.3.5 Calling the Base Class Function Using Super......Page 266 11.4 Search in Inheritance Tree......Page 267 11.5 Class Interface and Abstract Classes......Page 269 11.6 Conclusion......Page 272 12.1 Introduction......Page 280 12.2 _init_ Revisited......Page 281 12.2.1 Overloading _init_ (sort of)......Page 283 12.4 Overloading Binary Operators: The Fraction Example......Page 285 12.5 Overloading the += Operator......Page 291 12.6 Overloading the > and < Operators......Page 293 12.7 Overloading the _boolEan_ Operators: Precedence of _bool_over _len_......Page 294 12.8 Destructors......Page 297 12.9 Conclusion......Page 299 13.1 Introduction......Page 306 13.2 Importance and Mechanism......Page 308 13.2.1 An Example of Try/Catch......Page 309 13.3 Built-In Exceptions in Python......Page 310 13.4 The Process......Page 312 13.4.1 Exception Handling: Try/Except......Page 313 13.4.2 Raising Exceptions......Page 314 13.5 Crafting User Defined Exceptions......Page 315 13.6 An Example of Exception Handling......Page 316 13.7 Conclusion......Page 321 14.1 Introduction......Page 327 14.2 Abstract Data Type......Page 330 14.3 Algorithms......Page 332 14.4 Arrays......Page 333 14.5 Iterative and Recursive Algorithms......Page 339 14.5.1 Iterative Algorithms......Page 340 14.5.2 Recursive Algorithms......Page 343 14.6 Conclusion......Page 346 15.1 Introduction......Page 354 15.2 Stack......Page 355 15.3 Dynamic Implementation of Stacks......Page 358 15.4 Dynamic Implementation: Another Way......Page 360 15.5.1 Reversing a String......Page 361 15.5.2 Infix, Prefix, and Postfix Expressions......Page 363 15.6 Queue......Page 366 15.7 Conclusion......Page 371 16.1 Introduction......Page 378 16.2 Operations......Page 380 16.3 Implementing Stack Using a Linked List......Page 390 16.4 Queue Using a Linked List......Page 394 16.5 Conclusion......Page 397 17.1 Introduction......Page 403 17.2.1 Graphs: Definition and Representation......Page 404 17.2.2 Trees: Definition, Classification, and Representation......Page 405 17.2.3 Representation of a Binary Tree......Page 407 17.2.4 Tree Traversal: In-order, Pre-order, and Post-order......Page 409 17.3 Binary Search Tree......Page 411 17.3.1 Creation and Insertion......Page 412 17.3.2 Traversal......Page 417 17.3.3 Maximum and Minimum Elements......Page 420 17.4 Conclusion......Page 422 18.1 Introduction......Page 429 18.2 Introduction to NumPy and Creation of a Basic Array......Page 430 18.3.1 arange()......Page 433 18.3.2 linspace()......Page 434 18.4 Aggregate Functions......Page 435 18.5 Broadcasting......Page 440 18.6 Structured Arrays......Page 445 18.7 Conclusion......Page 447 19.1 Introduction......Page 455 19.2 The Plot Function......Page 456 19.3 Subplots......Page 466 19.4 3 Dimensional Plotting......Page 471 19.5 Conclusion......Page 477 20.1 Introduction......Page 483 20.2 Opening, Reading, and Writing an Image......Page 484 20.2.2 Reading......Page 485 20.2.4 Displaying an Image......Page 486 20.3 The Contour Function......Page 488 20.4 Clipping......Page 489 20.5 Statistical Information of an Image......Page 490 20.6.1 Translation......Page 491 20.6.2 Rotation......Page 493 20.6.3 Scaling......Page 495 20.7 Conclusion......Page 497 Appendix A: Multithreading in Python......Page 503 Appendix B: Regular Expressions......Page 510 Appendix C: Exercises for Practice: Programming Questions......Page 520 Appendix D: Problems for Practice: Multiple Choice Questions......Page 532 Appendix E: Answer to the Multiple Choice Questions......Page 544 Bibliography......Page 553 Index......Page 557 Python has become the language of choice for programmers in data science, game development, and numerous other areas. Learn the basics of Python programming in this step by step guide in a "teach yourself" format. Includes exercises with answers at the end of each chapter to help you to master the concepts and programming skills related to this important language. Designed with a self-instruction format for beginners - End of chapter questions (with answers) to reinforce mastery of topics - Includes a section on data structures to help understand the fundamental concepts - Offers in-depth treatment of topics such as classes, inheritance, BST and NumPy.- Introduces topics like MatPlotLib and PIL. "This book is designed for use as a primary introduction to Python and can be used as an introductory text or as a resource for professionals in industry. The book has been divided into four sections. The first section deals with the language fundamentals, primarily the procedural part of the language, the second introduces the object-oriented paradigms, the third section deals with data stractures, and the last is devoted to advanced topics like handling multi-dimensional arrays using NumPy and visualization using Matplotlib. Regular expressions and multi-threading have been introduced in the appendices." --Back cover Designed for use as a primary introduction to Python and can be used as an introductory text or as a resource for professionals in industry. The book includes sections dedicated to data structures; offers in-depth treatment of topics such as classes, inheritance, BST, andNumPy; and introduces topics like Matplotlib and PIL.
دانلود کتاب Python basics : [a self-teaching introduction