وبلاگ بلیان

Python All-in-One For Dummies (For Dummies (Computer/Tech))

معرفی کتاب «Python All-in-One For Dummies (For Dummies (Computer/Tech))» نوشتهٔ John C. Shovic, Alan Simpson, John Shovic، منتشرشده توسط نشر John Wiley & Sons در سال 2021. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است. «Python All-in-One For Dummies (For Dummies (Computer/Tech))» در دستهٔ بدون دسته‌بندی قرار دارد.

The one-stop resource for all your Python queries Powerful and flexible, Python is one of the most popular programming languages in the world. It's got all the right stuff for the software driving the cutting-edge of the development world—machine learning, robotics, artificial intelligence, data science, etc. The good news is that it's also pretty straightforward to learn, with a simplified syntax, natural-language flow, and an amazingly supportive user community. The latest edition of Python All-in-One For Dummies gives you an inside look at the exciting possibilities offered in the Python world and provides a springboard to launch yourself into wherever you want your coding career to take you. These 7 straightforward and friendly mini-books assume the reader is a beginning programmer, and cover everything from the basic elements of Python code to introductions to the specific applications where you'll use it. Intended as a hands-on reference, the focus is on practice over theory, providing you with examples to follow as well as code for you to copy and start modifying in the "real world"—helping you get up and running in your area of interest almost right away. This means you'll be finishing off your first app or building and remote-controlling your own robot much faster than you can believe. Get a thorough grounding in the language basics Learn how the syntax is applied in high-profile industries Apply Python to projects in enterprise Find out how Python can get you into hot careers in AI, big data, and more Whether you're a newbie coder or just want to add Python to your magic box of tricks, this is the perfect, practical introduction—and one you'll return to as you grow your career. Cover......Page 1 Title Page......Page 3 Copyright Page......Page 4 Table of Contents......Page 7 About This Book......Page 19 What to Buy......Page 20 Beyond the Book......Page 22 Where to Go from Here......Page 23 Book 1 Getting Started......Page 25 Chapter 1 Starting with Python......Page 27 Why Python Is Hot......Page 28 Choosing the Right Python......Page 29 Tools for Success......Page 31 Introducing Anaconda and VS Code......Page 32 Installing Anaconda and VS Code......Page 33 Writing Python in VS Code......Page 37 Choosing your Python interpreter......Page 39 Writing some Python code......Page 40 Using Jupyter Notebook for Coding......Page 41 Using Python’s Interactive Mode......Page 47 Opening Terminal......Page 48 Going into the Python Interpreter......Page 50 Using Python’s built-in help......Page 51 Exiting interactive help......Page 53 Lots of free cheat sheets......Page 54 Creating a Python Development Workspace......Page 55 Creating a Folder for Your Python Code......Page 57 Typing, Editing, and Debugging Python Code......Page 59 Writing Python code......Page 60 Saving your code......Page 61 Running Python in VS Code......Page 62 Learning simple debugging......Page 63 Using the VS Code Python debugger......Page 64 Creating a folder for Jupyter Notebook......Page 65 Creating and saving a Jupyter notebook......Page 66 Adding Markdown text......Page 67 Saving and opening notebooks......Page 69 The Zen of Python......Page 71 Introducing Object-Oriented Programming......Page 74 Discovering Why Indentations Count, Big Time......Page 75 Using Python Modules......Page 77 Understanding the syntax for importing modules......Page 79 Using an alias with modules......Page 80 Chapter 4 Building Your First Python Application......Page 81 Typing and Using Python Comments......Page 82 Understanding Python Data Types......Page 84 Numbers......Page 85 Words (strings)......Page 86 Booleans......Page 88 Arithmetic operators......Page 89 Comparison operators......Page 90 Boolean operators......Page 91 Creating and Using Variables......Page 92 Creating variables in code......Page 93 Manipulating variables......Page 94 Running your Python app in VS Code......Page 96 Understanding What Syntax Is and Why It Matters......Page 97 Putting Code Together......Page 102 Book 2 Understanding Python Building Blocks......Page 103 Calculating Numbers with Functions......Page 105 Still More Math Functions......Page 108 Formatting with f-strings......Page 111 Showing dollar amounts......Page 112 Formatting percent numbers......Page 113 Making multiline format strings......Page 115 Formatting width and alignment......Page 116 Binary, octal, and hexadecimal numbers......Page 118 Complex numbers......Page 119 Concatenating strings......Page 121 Getting the length of a string......Page 122 Working with common string operators......Page 123 Manipulating strings with methods......Page 125 Working with dates......Page 128 Working with times......Page 132 Calculating timespans......Page 134 Accounting for Time Zones......Page 138 Working with Time Zones......Page 140 Main Operators for Controlling the Action......Page 145 Making Decisions with if......Page 147 Adding else to your if logic......Page 150 Handling multiple else statements with elif......Page 151 Ternary operations......Page 153 Looping through numbers in a range......Page 154 Looping through a string......Page 156 Looping through a list......Page 157 Bailing out of a loop......Page 158 Looping with continue......Page 159 Nesting loops......Page 160 Looping with while......Page 161 Starting while loops over with continue......Page 163 Breaking while loops with break......Page 164 Defining and Using Lists......Page 167 Referencing list items by position......Page 168 Looping through a list......Page 169 Seeing whether a list contains an item......Page 170 Adding an item to the end of a list......Page 171 Inserting an item into a list......Page 172 Combining lists......Page 173 Removing list items......Page 174 Clearing out a list......Page 176 Counting how many times an item appears in a list......Page 177 Finding an list item’s index......Page 178 Alphabetizing and sorting lists......Page 179 Copying a list......Page 182 What’s a Tuple and Who Cares?......Page 183 Working with Sets......Page 185 Chapter 4 Cruising Massive Data with Dictionaries......Page 189 Understanding Data Dictionaries......Page 190 Creating a Data Dictionary......Page 192 Accessing dictionary data......Page 193 Seeing whether a key exists in a dictionary......Page 195 Getting dictionary data with get()......Page 196 Changing the value of a key......Page 197 Adding or changing dictionary data......Page 198 Looping through a Dictionary......Page 200 Data Dictionary Methods......Page 201 Copying a Dictionary......Page 202 Deleting Dictionary Items......Page 203 Having Fun with Multi-Key Dictionaries......Page 206 Using the mysterious fromkeys and setdefault methods......Page 208 Nesting dictionaries......Page 211 Chapter 5 Wrangling Bigger Chunks of Code......Page 213 Creating a Function......Page 214 Commenting a Function......Page 215 Passing Information to a Function......Page 216 Defining optional parameters with defaults......Page 218 Passing multiple values to a function......Page 219 Using keyword arguments (kwargs)......Page 221 Passing multiple values in a list......Page 223 Passing in an arbitrary number of arguments......Page 225 Returning Values from Functions......Page 226 Unmasking Anonymous Functions......Page 227 Mastering Classes and Objects......Page 235 Creating a Class......Page 238 Creating an Instance from a Class......Page 239 Giving an Object Its Attributes......Page 240 Creating an instance from a class......Page 241 Changing the value of an attribute......Page 244 Defining attributes with default values......Page 245 Giving a Class Methods......Page 246 Passing parameters to methods......Page 248 Calling a class method by class name......Page 249 Using class variables......Page 250 Using class methods......Page 252 Using static methods......Page 254 Understanding Class Inheritance......Page 256 Creating the base (main) class......Page 258 Defining a subclass......Page 259 Adding extra parameters from a subclass......Page 261 Calling a base class method......Page 264 Using the same name twice......Page 265 Chapter 7 Sidestepping Errors......Page 269 Understanding Exceptions......Page 270 Handling Errors Gracefully......Page 272 Being Specific about Exceptions......Page 273 Keeping Your App from Crashing......Page 275 Adding an else to the Mix......Page 277 Using try . . . except . . . else . . . finally......Page 279 Raising Your Own Exceptions......Page 281 Book 3 Working with Libraries......Page 287 Understanding Text and Binary Files......Page 289 Opening and Closing Files......Page 291 Reading a File’s Contents......Page 297 Looping with readlines()......Page 299 Looping with readline()......Page 301 Appending versus overwriting files......Page 302 Using tell() to determine the pointer location......Page 303 Moving the pointer with seek()......Page 304 Reading and Copying a Binary File......Page 305 Conquering CSV Files......Page 308 Opening a CSV file......Page 310 Converting strings......Page 311 Converting to date......Page 313 Converting to floats......Page 315 Converting from CSV to Objects and Dictionaries......Page 317 Importing CSV to Python objects......Page 318 Importing CSV to Python dictionaries......Page 321 Organizing JSON Data......Page 325 Understanding Serialization......Page 328 Loading Data from JSON Files......Page 330 Converting an Excel date to a JSON date......Page 331 Looping through a keyed JSON file......Page 332 Converting Firebase timestamps to Python dates......Page 335 Loading unkeyed JSON from a Python string......Page 336 Loading keyed JSON from a Python string......Page 337 Changing JSON data......Page 338 Removing data from a dictionary......Page 339 Dumping Python Data to JSON......Page 340 Seeing How the Web Works......Page 345 Understanding the mysterious URL......Page 346 Exposing the HTTP headers......Page 347 Opening a URL from Python......Page 349 Posting to the web with Python......Page 351 Scraping the web with Python......Page 352 Storing the parsed content......Page 355 Saving scraped data to a JSON file......Page 358 Saving scraped data to a CSV file......Page 359 Understanding the Python Standard Library......Page 361 Using the dir() function......Page 362 Using the help() function......Page 363 Exploring Python Packages......Page 365 Importing Python Modules......Page 367 Making Your Own Modules......Page 370 Book 4 Using Artificial Intelligence......Page 375 Chapter 1 Exploring Artificial Intelligence......Page 377 Neural networks......Page 378 Machine learning......Page 383 TensorFlow — A framework for deep learning......Page 384 Current Limitations of AI......Page 385 Chapter 2 Building a Neural Network......Page 387 Understanding Neural Networks......Page 388 Layers of neurons......Page 389 Weights and biases......Page 390 Loss function......Page 391 Building a Simple Neural Network in Python......Page 392 The neural-net Python code......Page 393 Using TensorFlow for the same neural network......Page 403 Installing the TensorFlow Python library......Page 404 Building a Python Neural Network in TensorFlow......Page 405 Evaluating the model......Page 406 Breaking down the code......Page 408 Checking the results......Page 410 Changing to a three-layer neural network in TensorFlow and Keras......Page 413 Chapter 3 Doing Machine Learning......Page 417 Learning by Looking for Solutions in All the Wrong Places......Page 418 Creating a Machine-Learning Network for Detecting Clothes Types......Page 419 Setting up the software environment......Page 420 Getting the data from the Fashion-MNIST dataset......Page 421 Testing our network......Page 422 Breaking down the code......Page 423 Results of the training and evaluation......Page 425 Testing a single test image......Page 426 Testing on external pictures......Page 427 The results, round 1......Page 429 The CNN model code......Page 430 The results, round 2......Page 432 Visualizing with MatPlotLib......Page 433 Learning More Machine Learning......Page 437 Limitations of the Raspberry Pi and AI......Page 439 Adding Hardware AI to the Raspberry Pi......Page 441 AI in the Cloud......Page 443 IBM Cloud......Page 445 AI on a Graphics Card......Page 446 Where to Go for More AI Fun in Python......Page 448 Book 5 Doing Data Science......Page 451 Chapter 1 Understanding the Five Areas of Data Science......Page 453 Volume......Page 454 Managing volume, variety, and velocity......Page 455 Processing the data......Page 456 Analyzing the data......Page 457 Maintaining the data......Page 458 Chapter 2 Exploring Big Data......Page 459 NumPy......Page 460 Pandas......Page 461 Diamonds are a data scientist’s best friend......Page 462 Breaking down the code......Page 465 Visualizing the data with MatPlotLib......Page 467 What Is Big Data?......Page 475 BigQuery from Google......Page 476 Computer security on the cloud......Page 477 Setting up your project and authentication......Page 478 The first big-data code......Page 481 Breaking down the code......Page 484 Doing a bit of analysis......Page 485 Payment percent by state......Page 488 Now some visualization......Page 489 Looking for the Most Polluted City in the World on an Hourly Basis......Page 491 Book 6 Talking to Hardware......Page 493 Chapter 1 Introducing Physical Computing......Page 495 What Is a Raspberry Pi?......Page 496 Building Projects That Move and Sense the Environment......Page 498 GPIO libraries......Page 500 Buying and assembling the hardware for “Hello World”......Page 501 Controlling an LED with Python......Page 505 But Wait, There’s More......Page 507 Chapter 2 No Soldering! Using Grove Connectors for Building......Page 511 Selecting a Grove base unit......Page 512 Error-proofing with a Grove connector......Page 514 Grove digital — All about those 1s and 0s......Page 516 Grove analog: When 1s and 0s aren’t enough......Page 517 Grove UART (or serial) — bit-by-bit transmission......Page 518 Grove I2C — Using I2C to make sense of the world......Page 520 Connecting with Grove Cables......Page 521 An example of the power of the patch!......Page 523 Second example: The Adafruit Ultimate GPS......Page 524 Understanding I2C......Page 527 Enabling I2C on the Raspberry Pi......Page 529 The hardware for reading temperature and humidity......Page 530 Reading temperature and humidity from an I2C device using Python......Page 533 Breaking down the program......Page 536 Measuring Oxygen and a Flame......Page 539 The Grove oxygen sensor......Page 540 Hooking up the oxygen experiment......Page 542 Breaking down the code......Page 545 Interpreting the results......Page 546 HDC1080 temperature and humidity sensor redux......Page 548 Adding the Blynk dashboard......Page 549 The modified temperatureTest.py software for the Blynk app......Page 552 Breaking down the code......Page 554 Where to Go from Here......Page 557 Exploring Electric Motors......Page 559 Small DC motors......Page 560 Stepper motors......Page 561 Controlling a DC Motor......Page 562 Grove I2C motor driver......Page 563 Python DC motor software......Page 566 Running a Servo Motor......Page 569 Python servo software......Page 573 Breaking down the code......Page 574 Making a Stepper Motor Step......Page 576 Python stepper software......Page 584 Breaking down the code......Page 585 Book 7 Building Robots......Page 587 A Robot Is Not Always Like a Human......Page 589 Not Every Robot Has Arms or Wheels......Page 590 The Wilkinson bread-making robot......Page 591 Baxter, the coffee-making robot......Page 592 The Griffin Bluetooth-enabled toaster......Page 593 Computers......Page 594 Sensors......Page 595 Programming Robots......Page 596 Chapter 2 Building Your First Python Robot......Page 597 What you need for the build......Page 598 Understanding the robot components......Page 599 Assembling the Robot......Page 608 Calibrating your servos......Page 610 Installing software for the PiCar-B Python test......Page 613 The PiCar-B Python test code......Page 614 Pi camera video testing......Page 615 Building a Simple, High-Level Python Interface......Page 619 The wheelsLeft function()......Page 620 Making a Single Move with Python......Page 621 Functions of the RobotInterface Class......Page 622 Front LED functions......Page 623 Pixel strip functions......Page 624 Main motor functions......Page 626 Servo functions......Page 627 The Python Robot Interface Test......Page 631 Coordinating Motor Movements with Sensors......Page 635 Making a Python Brain for Our Robot......Page 639 Overview of the Included Adeept Software......Page 646 Where to Go from Here......Page 647 Chapter 4 Using Artificial Intelligence in Robotics......Page 649 Setting Up the First Project......Page 650 Machine Learning Using TensorFlow......Page 651 The code......Page 653 How the code works......Page 655 The results......Page 658 The code......Page 660 How the code works......Page 662 The results......Page 664 Taking Cats and Dogs to Our Robot......Page 666 The code......Page 667 The results......Page 670 Setting Up the Second Project......Page 672 The FindAndChaseTheBall.py Python Program......Page 673 The ultrasonic thread......Page 674 The OpenCV frame analyzer thread......Page 675 The program’s configuration......Page 679 Setting the ball’s color......Page 680 Program notes......Page 682 AI and the Future of Robotics......Page 684 Index......Page 685

The one-stop resource for all your Python queries

Powerful and flexible, Python is one of the most popular programming languages in the world. It's got all the right stuff for the software driving the cutting-edge of the development world—machine learning, robotics, artificial intelligence, data science, etc. The good news is that it's also pretty straightforward to learn, with a simplified syntax, natural-language flow, and an amazingly supportive user community. The latest edition of Python All-in-One For Dummies gives you an inside look atthe exciting possibilities offered in the Python world and provides a springboard to launch yourself into wherever you want your coding career to take you.

These 7 straightforward and friendly mini-books assume the reader is a beginning programmer, and cover everything from the basic elements of Python code to introductions to the specific applications where you'll use it. Intended as a hands-on reference, the focus is on practice over theory, providing you with examples to follow as well as code for you to copy and start modifying in the "real world"—helping you get up and running in your area of interest almost right away. This means you'll be finishing off your first app or building and remote-controlling your own robot much faster than you can believe.

  • Get a thorough grounding in the language basics
  • Learn how the syntax is applied in high-profile industries
  • Apply Python to projects in enterprise
  • Find out how Python can get you into hot careers in AI, big data, and more

Whether you're a newbie coder or just want to add Python to your magic box of tricks, this is the perfect, practical introduction—and one you'll return to as you grow your career.

دانلود کتاب Python All-in-One For Dummies (For Dummies (Computer/Tech))