Python Without Fear

Paperback Engels 2017 9780134687476
Verwachte levertijd ongeveer 9 werkdagen

Samenvatting

Python Without Fear is the ideal book for people who’ve programmed in any language before—such as C, C++, Basic, or Java—and want to learn Python as painlessly and reliably as possible. It will also provide an easy-to- read guide explaining how Python works under the covers. In short, it’s the ideal beginner-to- intermediate Python book.

Specificaties

ISBN13:9780134687476
Taal:Engels
Bindwijze:Paperback

Lezersrecensies

Wees de eerste die een lezersrecensie schrijft!

Inhoudsopgave

<p>Preface xvii</p> <p>Acknowledgments xxi</p> <p>Author Bio xxiii</p> <p><strong>Chapter 1: Meet the Python 1</strong></p> <p>A Brief History of Python 1</p> <p>How Python Is Different 2</p> <p>How This Book Works 3</p> <p>Installing Python 4</p> <p>Begin Using Python with IDLE 6</p> <p>Correcting Mistakes from Within IDLE 6</p> <p>Dealing with Ends of Lines 7</p> <p>Additional Help: Online Sources 8</p> <p><strong>Chapter 2: A Python Safari: Numbers 9</strong></p> <p>Python and Numbers 9</p> <p>Python and Floating-Point Numbers 14</p> <p>Assigning Numbers to Variables 17</p> <p>Variable-Naming Conventions in This Book 23</p> <p>Some Python Shortcuts 23</p> <p>Chapter 2 Summary 26</p> <p><strong>Chapter 3: Your First Programs 29</strong></p> <p>Temperatures Rising? 29</p> <p>Putting in a Print Message 35</p> <p>Syntax Summaries 36</p> <p>Getting String Input 41</p> <p>Getting Numeric Input 43</p> <p>Formatted Output String 46</p> <p>Chapter 3 Summary 50</p> <p><strong>Chapter 4: Decisions and Looping 53</strong></p> <p>Decisions Inside a Computer Program 53</p> <p>Conditional and Boolean Operators 55</p> <p>The if, elif, and else Keywords 56</p> <p>while: Looping the Loop 60</p> <p> “Give Me a break” Statement 70</p> <p>Chapter 4 Summary 75</p> <p><strong>Chapter 5: Python Lists 77</strong></p> <p>The Python Way: The World Is Made of Collections 77</p> <p>Processing Lists with for 80</p> <p>Modifying Elements with for (You Can't!) 82</p> <p>Indexing and Slicing 85</p> <p>Copying Data to Slices 88</p> <p>Ranges 89</p> <p>List Functions and the in Keyword 97</p> <p>Chapter 5 Summary 99</p> <p><strong>Chapter 6: List Comprehension and Enumeration 101</strong></p> <p>Indexes and the enumerate Function 101</p> <p>The Format String Method Revisited 103</p> <p>Simple List Comprehension 106</p> <p>“Two-Dimensional” List Comprehension 112</p> <p>List Comprehension with Conditional 114</p> <p>Chapter 6 Summary 123</p> <p><strong>Chapter 7: Python Strings 125</strong></p> <p>Creating a String with Quote Marks 125</p> <p>Indexing and “Slicing” 127</p> <p>String/Number Conversions 130</p> <p>Stripping for Fun and Profit 135</p> <p>Let’s Split: The split Method 138</p> <p>Building Strings with Concatenation (+) 139</p> <p>The join Method 143</p> <p>Chapter 7 Summary 144</p> <p><strong>Chapter 8: Single-Character Ops 147</strong></p> <p>Naming Conventions in This Chapter 147</p> <p>Accessing Individual Characters (A Review) 148</p> <p>Getting Help with String Methods 148</p> <p>Testing Uppercase vs. Lowercase 149</p> <p>Converting Case of Letters 150</p> <p>Testing for Palindromes 151</p> <p>Converting to ASCII Code 159</p> <p>Converting ASCII to Character 160</p> <p>Chapter 8 Summary 166</p> <p><strong>Chapter 9: Advanced Function Techniques 167</strong></p> <p>Multiple Arguments 167</p> <p>Returning More Than One Value 168</p> <p>Arguments by Name 173</p> <p>Default Arguments 174</p> <p>Importing Functions from Modules 178</p> <p>Chapter 9 Summary 185</p> <p><strong>Chapter 10: Local and Global Variables 187</strong></p> <p>Local Variables, What Are They Good For? 187</p> <p>Locals vs. Globals 188</p> <p>Introducing the global Keyword 190</p> <p>The Python “Local Variable Trap” 190</p> <p>Chapter 10 Summary 204</p> <p><strong>Chapter 11: File Ops 207</strong></p> <p>Text Files vs. Binary Files 207</p> <p>The Op System (os) Module 208</p> <p>Open a File 211</p> <p>Let’s Write a Text File 213</p> <p>Read a Text File 216</p> <p>Files and Exception Handling 217</p> <p>Other File Modes 223</p> <p>Chapter 11 Summary 224</p> <p><strong>Chapter 12: Dictionaries and Sets 227</strong></p> <p>Why Do We Need Dictionaries, Ms. Librarian? 227</p> <p>Adding and Changing Key-Value Pairs 229</p> <p>Accessing Values 230</p> <p>Searching for Keys 231</p> <p>Converting Dictionaries to Lists 235</p> <p>All About Sets 241</p> <p>Operations on Sets 242</p> <p>Chapter 12 Summary 246</p> <p><strong>Chapter 13: Matrixes: 2-D Lists 249</strong></p> <p>Simple Matrixes 249</p> <p>Accessing Elements 250</p> <p>Irregular Matrixes and Length of a Row 251</p> <p>Multiplication (*) and Lists 252</p> <p>The Python Matrix Problem 253</p> <p>How to Create N*M Matrixes: The Solution 254</p> <p>How to Rotate a Matrix 261</p> <p>Chapter 13 Summary 268</p> <p><strong>Chapter 14: Winning at Tic-Tac-Toe 271</strong></p> <p>Design of a Tic-Tac-Toe Board 271</p> <p>Plan of This Chapter 273</p> <p>Python One-Line if/else 274</p> <p>The count Method for Lists 279</p> <p>Introducing the Computer Player 285</p> <p>Chapter 14 Summary 294</p> <p><strong>Chapter 15: Classes and Objects I 295</strong></p> <p>What’s an Object? 295</p> <p>Classes in Python 296</p> <p>The All-Important _ _init_ Method 301</p> <p>Design for a Database Class 303</p> <p>Defining Other Methods 309</p> <p>Design for a Point3D Class 310</p> <p>Point3D Class and Default Arguments 312</p> <p>Three-Dimensional Tic-Tac-Toe 312</p> <p>Chapter 15 Summary 318</p> <p><strong>Chapter 16: Classes and Objects II 321</strong></p> <p>Getting Help from Doc Strings 321</p> <p>Function Typing and “Overloading” 323</p> <p>Variable-Length Argument Lists 326</p> <p>Inheritance 331</p> <p>The Fraction Class 333</p> <p>Class Variables and Methods 337</p> <p>Instance Variables as “Default” Values 339</p> <p>Chapter 16 Summary 344</p> <p><strong>Chapter 17: Conway’s Game of Life 347</strong></p> <p>Game of Life: The Rules of the Game 348</p> <p>Generating the Neighbor Count 350</p> <p>Design of the Program 352</p> <p>Moving the Matrix Class to a Module 354</p> <p>The Famous Slider Pattern 358</p> <p>Chapter 17 Summary 364</p> <p><strong>Chapter 18: Advanced Pythonic Techniques 367</strong></p> <p>Generators 367</p> <p>Exploiting the Power of Generators 369</p> <p>Properties 375</p> <p>Decorators: Functions Enclosing Other Functions 382</p> <p>Python Decoration 385</p> <p>Chapter 18 Summary 389</p> <p>Appendix A: Python Operator Precedence Table 391</p> <p>Appendix B: Summary of Most Important Formatting Rules for Python 3.0 393</p> <p>1. Formatting Ordinary Text 393</p> <p>2. Formatting Arguments 393</p> <p>3. Specifying Order of Arguments 393</p> <p>4. Right Justification Within Field of Size N 394</p> <p>5. Left Justification Within Field of Size N 394</p> <p>6. Truncation: Limit Size of Print Field 394</p> <p>7. Combined Truncation and Justification 395</p> <p>8. Length and Precision of Floating-Point Numbers 395</p> <p>9. The Padding Character 395</p> <p><strong>Appendix C: Glossary 397</strong></p> <p>Index 407</p>

Managementboek Top 100

Rubrieken

    Personen

      Trefwoorden

        Python Without Fear