Python Basics A Self-Teaching Introduction
Book information
Description
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
Similar books
Python for OSINT. 21 day course for beginners
2023 · PDF
Foundations of PyGTK Development: GUI Creation with Python, 2nd Edition
2019 · EPUB
Game Development Using Python
2018 · PDF
Python Programming for Raspberry Pi in 24 Hours
2013 · EPUB
Python for Scientists, 2nd Edition
2017 · AZW3
Intermediate Python
2015 · PDF
Beginning PyQt: A Hands-On Approach to GUI Programming with PyQt6, 2nd Edition
2022 · EPUB
asyncio Recipes: A Problem-Solution Approach
2019 · EPUB