Python All-in-One For Dummies, 2nd Edition

Book description

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.

Table of contents

  1. Cover
  2. Title Page
  3. Copyright
  4. Introduction
    1. About This Book
    2. Foolish Assumptions
    3. What to Buy
    4. Icons Used in This Book
    5. Beyond the Book
    6. Where to Go from Here
  5. Book 1: Getting Started
    1. Chapter 1: Starting with Python
      1. Why Python Is Hot
      2. Choosing the Right Python
      3. Tools for Success
      4. Writing Python in VS Code
      5. Using Jupyter Notebook for Coding
    2. Chapter 2: Interactive Mode, Getting Help, and Writing Apps
      1. Using Python's Interactive Mode
      2. Creating a Python Development Workspace
      3. Creating a Folder for Your Python Code
      4. Typing, Editing, and Debugging Python Code
      5. Writing Code in a Jupyter Notebook
    3. Chapter 3: Python Elements and Syntax
      1. The Zen of Python
      2. Introducing Object-Oriented Programming
      3. Discovering Why Indentations Count, Big Time
      4. Using Python Modules
    4. Chapter 4: Building Your First Python Application
      1. Opening the Python App File
      2. Typing and Using Python Comments
      3. Understanding Python Data Types
      4. Working with Python Operators
      5. Creating and Using Variables
      6. Understanding What Syntax Is and Why It Matters
      7. Putting Code Together
  6. Book 2: Understanding Python Building Blocks
    1. Chapter 1: Working with Numbers, Text, and Dates
      1. Calculating Numbers with Functions
      2. Still More Math Functions
      3. Formatting Numbers
      4. Grappling with Weirder Numbers
      5. Manipulating Strings
      6. Uncovering Dates and Times
      7. Accounting for Time Zones
      8. Working with Time Zones
    2. Chapter 2: Controlling the Action
      1. Main Operators for Controlling the Action
      2. Making Decisions with if
      3. Repeating a Process with for
      4. Looping with while
    3. Chapter 3: Speeding Along with Lists and Tuples
      1. Defining and Using Lists
      2. What's a Tuple and Who Cares?
      3. Working with Sets
    4. Chapter 4: Cruising Massive Data with Dictionaries
      1. Understanding Data Dictionaries
      2. Creating a Data Dictionary
      3. Looping through a Dictionary
      4. Data Dictionary Methods
      5. Copying a Dictionary
      6. Deleting Dictionary Items
      7. Having Fun with Multi-Key Dictionaries
    5. Chapter 5: Wrangling Bigger Chunks of Code
      1. Creating a Function
      2. Commenting a Function
      3. Passing Information to a Function
      4. Returning Values from Functions
      5. Unmasking Anonymous Functions
    6. Chapter 6: Doing Python with Class
      1. Mastering Classes and Objects
      2. Creating a Class
      3. Creating an Instance from a Class
      4. Giving an Object Its Attributes
      5. Giving a Class Methods
      6. Understanding Class Inheritance
    7. Chapter 7: Sidestepping Errors
      1. Understanding Exceptions
      2. Handling Errors Gracefully
      3. Being Specific about Exceptions
      4. Keeping Your App from Crashing
      5. Adding an else to the Mix
      6. Using try … except … else … finally
      7. Raising Your Own Exceptions
  7. Book 3: Working with Libraries
    1. Chapter 1: Working with External Files
      1. Understanding Text and Binary Files
      2. Opening and Closing Files
      3. Reading a File’s Contents
      4. Looping through a File
      5. Reading and Copying a Binary File
      6. Conquering CSV Files
      7. Converting from CSV to Objects and Dictionaries
    2. Chapter 2: Juggling JSON Data
      1. Organizing JSON Data
      2. Understanding Serialization
      3. Loading Data from JSON Files
      4. Dumping Python Data to JSON
    3. Chapter 3: Interacting with the Internet
      1. Seeing How the Web Works
    4. Chapter 4: Libraries, Packages, and Modules
      1. Understanding the Python Standard Library
      2. Exploring Python Packages
      3. Importing Python Modules
      4. Making Your Own Modules
  8. Book 4: Using Artificial Intelligence
    1. Chapter 1: Exploring Artificial Intelligence
      1. AI Is a Collection of Techniques
      2. Current Limitations of AI
    2. Chapter 2: Building a Neural Network
      1. Understanding Neural Networks
      2. Building a Simple Neural Network in Python
      3. Building a Python Neural Network in TensorFlow
    3. Chapter 3: Doing Machine Learning
      1. Learning by Looking for Solutions in All the Wrong Places
      2. Creating a Machine-Learning Network for Detecting Clothes Types
      3. Visualizing with MatPlotLib
      4. Learning More Machine Learning
    4. Chapter 4: Exploring AI
      1. Limitations of the Raspberry Pi and AI
      2. Adding Hardware AI to the Raspberry Pi
      3. AI in the Cloud
      4. AI on a Graphics Card
      5. Where to Go for More AI Fun in Python
  9. Book 5: Doing Data Science
    1. Chapter 1: Understanding the Five Areas of Data Science
      1. Working with Big, Big Data
      2. Cooking with Gas: The Five-Step Process of Data Science
    2. Chapter 2: Exploring Big Data
      1. Introducing NumPy, Pandas, and MatPlotLib
      2. Doing Your First Data Science Project
    3. Chapter 3: Using Big Data from Google Cloud
      1. What Is Big Data?
      2. Understanding Google Cloud and BigQuery
      3. Reading the Medicare Big Data
      4. Looking for the Most Polluted City in the World on an Hourly Basis
  10. Book 6: Talking to Hardware
    1. Chapter 1: Introducing Physical Computing
      1. Physical Computing Is Fun
      2. What Is a Raspberry Pi?
      3. Building Projects That Move and Sense the Environment
      4. Sensing the Environment with the Raspberry Pi
      5. Controlling an LED with Python
      6. But Wait, There's More
    2. Chapter 2: No Soldering! Using Grove Connectors for Building
      1. Working with the Grove System
      2. Grove Connectors
      3. Connecting with Grove Cables
    3. Chapter 3: Sensing the World
      1. Understanding I2C
      2. Measuring Oxygen and a Flame
      3. Building a Dashboard on Your Phone with Blynk
      4. Where to Go from Here
    4. Chapter 4: Making Things Move
      1. Exploring Electric Motors
      2. Controlling a DC Motor
      3. Running a Servo Motor
      4. Making a Stepper Motor Step
  11. Book 7: Building Robots
    1. Chapter 1: Introducing Robotics
      1. A Robot Is Not Always Like a Human
      2. Not Every Robot Has Arms or Wheels
      3. Understanding the Main Parts of a Robot
      4. Programming Robots
    2. Chapter 2: Building Your First Python Robot
      1. Introducing the Mars Rover PiCar-B
      2. Assembling the Robot
      3. Testing Your Robot
    3. Chapter 3: Programming Your Robot Rover
      1. Building a Simple, High-Level Python Interface
      2. Making a Single Move with Python
      3. Functions of the RobotInterface Class
      4. The Python Robot Interface Test
      5. Coordinating Motor Movements with Sensors
      6. Making a Python Brain for Our Robot
      7. Overview of the Included Adeept Software
      8. Where to Go from Here
    4. Chapter 4: Using Artificial Intelligence in Robotics
      1. This Chapter’s Projects: Going to the Dogs
      2. Setting Up the First Project
      3. Machine Learning Using TensorFlow
      4. Testing the Trained Network
      5. Taking Cats and Dogs to Our Robot
      6. Setting Up the Second Project
      7. The FindAndChaseTheBall.py Python Program
      8. The Main Program
      9. AI and the Future of Robotics
  12. Index
  13. About the Authors
  14. Connect with Dummies
  15. End User License Agreement

Product information

  • Title: Python All-in-One For Dummies, 2nd Edition
  • Author(s): John C. Shovic, Alan Simpson
  • Release date: April 2021
  • Publisher(s): For Dummies
  • ISBN: 9781119787600