Python Crash Course, 2nd Edition

Book description

This is the second edition of the best selling Python book in the world. Python Crash Course, 2nd Edition is a straightforward introduction to the core of Python programming. Author Eric Matthes dispenses with the sort of tedious, unnecessary information that can get in the way of learning how to program, choosing instead to provide a foundation in general programming concepts, Python fundamentals, and problem solving. Three real-world projects in the second part of the book allow readers to apply their knowledge in useful ways.

Readers will learn how to create a simple video game, use data visualization techniques to make graphs and charts, and build and deploy an interactive web application. Python Crash Course, 2nd Edition teaches beginners the essentials of Python quickly so that they can build practical programs and develop powerful programming techniques.

Uses Python 3

Table of contents

  1. Cover Page
  2. Title Page
  3. Copyright Page
  4. About the Author
  5. About the Technical Reviewer
  6. Dedication
  7. BRIEF CONTENTS
  8. CONTENTS IN DETAIL
  9. PREFACE TO THE SECOND EDITION
  10. ACKNOWLEDGMENTS
  11. INTRODUCTION
    1. Who Is This Book For?
    2. What Can You Expect to Learn?
    3. Online Resources
    4. Why Python?
  12. PART I: BASICS
  13. 1 GETTING STARTED
    1. Setting Up Your Programming Environment
    2. Python on Different Operating Systems
    3. Running a Hello World Program
    4. Troubleshooting
    5. Running Python Programs from a Terminal
    6. Summary
  14. 2 VARIABLES AND SIMPLE DATA TYPES
    1. What Really Happens When You Run hello_world.py
    2. Variables
    3. Strings
    4. Numbers
    5. Comments
    6. The Zen of Python
    7. Summary
  15. 3 INTRODUCING LISTS
    1. What Is a List?
    2. Changing, Adding, and Removing Elements
    3. Organizing a List
    4. Avoiding Index Errors When Working with Lists
    5. Summary
  16. 4 WORKING WITH LISTS
    1. Looping Through an Entire List
    2. Avoiding Indentation Errors
    3. Making Numerical Lists
    4. Working with Part of a List
    5. Tuples
    6. Styling Your Code
    7. Summary
  17. 5 IF STATEMENTS
    1. A Simple Example
    2. Conditional Tests
    3. if Statements
    4. Using if Statements with Lists
    5. Styling Your if Statements
    6. Summary
  18. 6 DICTIONARIES
    1. A Simple Dictionary
    2. Working with Dictionaries
    3. Looping Through a Dictionary
    4. Nesting
    5. Summary
  19. 7 USER INPUT AND WHILE LOOPS
    1. How the input() Function Works
    2. Introducing while Loops
    3. Using a while Loop with Lists and Dictionaries
    4. Summary
  20. 8 FUNCTIONS
    1. Defining a Function
    2. Passing Arguments
    3. Return Values
    4. Passing a List
    5. Passing an Arbitrary Number of Arguments
    6. Storing Your Functions in Modules
    7. Styling Functions
    8. Summary
  21. 9 CLASSES
    1. Creating and Using a Class
    2. Working with Classes and Instances
    3. Inheritance
    4. Importing Classes
    5. The Python Standard Library
    6. Styling Classes
    7. Summary
  22. 10 FILES AND EXCEPTIONS
    1. Reading from a File
    2. Writing to a File
    3. Exceptions
    4. Storing Data
    5. Summary
  23. 11 TESTING YOUR CODE
    1. Testing a Function
    2. Testing a Class
    3. Summary
  24. PART II: PROJECTS
  25. PROJECT 1: ALIEN INVASION
  26. 12 A SHIP THAT FIRES BULLETS
    1. Planning Your Project
    2. Installing Pygame
    3. Starting the Game Project
    4. Adding the Ship Image
    5. Refactoring: The _check_events() and _update_screen() Methods
    6. Piloting the Ship
    7. A Quick Recap
    8. Shooting Bullets
    9. Summary
  27. 13 ALIENS!
    1. Reviewing the Project
    2. Creating the First Alien
    3. Building the Alien Fleet
    4. Making the Fleet Move
    5. Shooting Aliens
    6. Ending the Game
    7. Summary
  28. 14 SCORING
    1. Adding the Play Button
    2. Leveling Up
    3. Scoring
    4. Summary
  29. PROJECT 2: DATA VISUALIZATION
  30. 15 GENERATING DATA
    1. Installing Matplotlib
    2. Plotting a Simple Line Graph
    3. Random Walks
    4. Rolling Dice with Plotly
    5. Summary
  31. 16 DOWNLOADING DATA
    1. The CSV File Format
    2. Mapping Global Data Sets: JSON Format
    3. Summary
  32. 17 WORKING WITH APIs
    1. Using a Web API
    2. Visualizing Repositories Using Plotly
    3. The Hacker News API
    4. Summary
  33. PROJECT 3: WEB APPLICATIONS
  34. 18 GETTING STARTED WITH DJANGO
    1. Setting Up a Project
    2. Starting an App
    3. Making Pages: The Learning Log Home Page
    4. Building Additional Pages
    5. Summary
  35. 19 USER ACCOUNTS
    1. Allowing Users to Enter Data
    2. Setting Up User Accounts
    3. Allowing Users to Own Their Data
    4. Summary
  36. 20 STYLING AND DEPLOYING AN APP
    1. Styling Learning Log
    2. Deploying Learning Log
    3. Summary
  37. AFTERWORD
  38. A INSTALLATION AND TROUBLESHOOTING
    1. Python on Windows
    2. Python on macOS
    3. Python on Linux
    4. Python Keywords and Built-in Functions
  39. B TEXT EDITORS AND IDEs
    1. Customizing Sublime Text Settings
    2. Other Text Editors and IDEs
  40. C GETTING HELP
    1. First Steps
    2. Searching Online
    3. Internet Relay Chat
    4. Slack
    5. Discord
  41. D USING GIT FOR VERSION CONTROL
    1. Installing Git
    2. Making a Project
    3. Ignoring Files
    4. Initializing a Repository
    5. Checking the Status
    6. Adding Files to the Repository
    7. Making a Commit
    8. Checking the Log
    9. The Second Commit
    10. Reverting a Change
    11. Checking Out Previous Commits
    12. Deleting the Repository
  42. INDEX

Product information

  • Title: Python Crash Course, 2nd Edition
  • Author(s): Eric Matthes
  • Release date: May 2019
  • Publisher(s): No Starch Press
  • ISBN: 9781593279288