Python 101
Python 101
$19.99
Minimum price
$24.99
Suggested price
Python 101

This book is 65% complete

Last updated on 2020-05-30

About the Book

The second edition of Python 101 is completely rewritten from the ground up. In this book, you will learn the Python programming language and lots more.

This book is split up into four sections:

  1. The Python Language
  2. Intermediate Topics
  3. Creating Sample Applications
  4. Distributing Your Code

Following is how it will break down in more detail:

Part I - The Python Language

  • 01 - Installation
  • 02 - Python editors
  • 03 - Python style guide / comment rules
  • 04 - Integers and floats 
  • 05 - Lists
  • 06 - Tuples 
  • 07 - Dictionaries
  • 08 - Sets
  • 09 - Strings
  • 10 - Boolean
  • 11 - Conditional statements
  • 12 - Loops
  • 13 - Comprehensions
  • 14 - Exception Handling
  • 15 - Files 
  • 16 - Imports
  • 17 - Functions
  • 18 - Classes

In Part 2 - Intermediate Topics, you will then learn about some intermediate topics, such as:

  • Introspection
  • Pip
  • Python virtual environments
  • Threading
  • Multiprocessing
  • Debugging
  • Decorators
  • Profiling
  • Testing
  • Version Control (git)

In Part 3 - Creating Sample Applications, you will learn how to write sample applications:

  • How to create a command line application (argparse)
  • How to parse XML
  • How to parse JSON
  • How to Scrape a website
  • How to Work with CSV files
  • How to work with a database (sqlite)
  • How to Create an Excel document
  • How to Generate a PDF

Finally in Part 4 you will learn how distribute your code as an executable and as source.

About the Author

Michael Driscoll
Michael Driscoll

Michael has been programming with Python since 2006. He is the author of the popular Python blog, The Mouse Vs. the Python. Michael has been a technical reviewer for Packt Publishing and No Starch Press.  He is also a contributor on Real Python.

He also co-authored The Essential Core Python Cheat Sheet for DZone.

Michael released his first book, Python 101, June 3rd, 2014. He wrote the follow up, Python 201: Intermediate Python and published it in the summer of 2016. He is also the author of wxPython Cookbook from Apress as well as Python Interviews from Packt Publishing.

Michael is currently working on some new books as well.

Table of Contents

  • Introduction
    • Part I - The Basics
    • Part II - Intermediate Materials
    • Part III - Tutorials
    • Part IV - Python Packaging and Distribution
    • Target Audience
    • About the Author
    • Conventions
    • Requirements
    • Book Source Code
    • Reader Feedback
    • Errata
  • Part I - The Python Language
  • Chapter 1 - Installing Python
    • Installing on Windows
    • Installing on Mac
    • Installing on Linux
    • Android / iOS
    • Other Operating Systems
    • Other Python Variants
    • Wrapping Up
  • Chapter 2 - Python Editors
    • What About the REPL?
    • Getting Started with IDLE
    • Getting Started with PyCharm Community Edition
    • Getting Started with Wing Personal
    • Getting Started with Visual Studio Code
    • Wrapping Up
  • Chapter 3 - Documenting Your Code
    • What are Comments?
    • Commenting Out
    • Multiline Comments
    • Learning About docstrings
    • Python’s Style Guide: PEP8
    • Tools that can help
    • Wrapping Up
    • Review Questions
  • Chapter 4 - Working with Strings
    • Creating Strings
    • String Methods
    • String Formatting
    • Formatting Strings Using %s (printf-style)
    • Formatting Strings Using .format()
    • Formatting Strings with f-strings
    • String Concatenation
    • String Slicing
    • Wrapping Up
    • Review Questions
  • Chapter 5 - Numeric Types
    • Integers
    • Floats
    • Complex Numbers
    • Numeric Operations
    • Augmented Assignment
    • Wrapping Up
    • Review Questions
  • Chapter 6 - Learning About Lists
    • Creating Lists
    • List Methods
    • List Slicing
    • Copying a List
    • Wrapping Up
    • Review Questions
  • Chapter 7 - Learning About Tuples
    • Creating Tuples
    • Working With Tuples
    • Concatenating Tuples
    • Special Case Tuples
    • Wrapping Up
    • Review Questions
  • Chapter 8 - Learning About Dictionaries
    • Creating Dictionaries
    • Accessing Dictionaries
    • Dictionary Methods
    • Modifying Your Dictionary
    • Deleting Items From Your Dictionary
    • Wrapping Up
    • Review Questions
  • Chapter 9 - Learning About Sets
    • Creating a Set
    • Accessing Set Members
    • Changing Items
    • Adding Items
    • Removing Items
    • Clearing or Deleting a Set
    • Set Operations
    • Wrapping Up
    • Review Questions
  • Chapter 10 - Boolean Operations and None
    • The bool() Function
    • What About None?
    • Wrapping Up
    • Review Questions
  • Chapter 11 - Conditional Statements
    • Comparison Operators
    • Creating a Simple Conditional
    • Branching Conditional Statements
    • Nesting Conditionals
    • Logical Operators
    • Special Operators
    • Wrapping Up
    • Review Question
  • Chapter 12 - Learning About Loops
    • Creating a for Loop
    • Looping Over a String
    • Looping Over a Dictionary
    • Extracting Multiple Values in a Tuple While Looping
    • Using enumerate with Loops
    • Creating a while Loop
    • Breaking Out of a Loop
    • Using continue
    • Loops and the else Statement
    • Nesting Loops
    • Wrapping Up
    • Review Questions
  • Chapter 13 - Python Comprehensions
    • List Comprehensions
    • Nested List Comprehensions
    • Dictionary Comprehensions
    • Set Comprehensions
    • Wrapping Up
    • Review Questions
  • Chapter 14 - Exception Handling
    • The Most Common Exceptions
    • Handling Exceptions
    • Raising Exceptions
    • Examining the Exception Object
    • Using the finally Statement
    • Using the else Statement
    • Wrapping Up
    • Review Questions
  • Chapter 15 - Working with Files
    • The open() Function
    • Reading Files
    • Reading Binary Files
    • Writing Files
    • Seeking Within a File
    • Appending to Files
    • Catching File Exceptions
    • Wrapping Up
    • Review Questions
  • Chapter 16 - Importing
    • Using import
    • Using from to Import Sub-Modules
    • Importing Everything
    • Wrapping Up
    • Review Questions
  • Chapter 17 - Functions
    • Creating a Function
    • Calling a Function
    • Passing Arguments
    • Type Hinting Your Arguments
    • Passing Keyword Arguments
    • Required and Default Arguments
    • What are *args and **kwargs?
    • Positional-only Parameters
    • Scope
    • Wrapping Up
    • Review Questions
  • Chapter 18 - Classes
    • Class Creation
    • Figuring Out self
    • Public and Private Methods / Attributes
    • Subclass Creation
    • Polymorphism
    • Making the Class Nicer
    • Wrapping Up
    • Review Questions
  • Part II - Beyond the Basics
  • Chapter 19 - Introspection
    • Using the type() Function
    • Using the dir() Function
    • Getting help()
    • Other Built-in Introspection Tools
    • Wrapping Up
    • Review Questions
  • Chapter 20 - Installing Packages with pip
    • Installing Your First Package
    • Exploring Command Line Options
    • Installing with requirements.txt
    • Upgrading a Package
    • Checking What’s Installed
    • Uninstalling Packages
    • Alternatives to pip
    • Wrapping Up
    • Review Questions
  • Chapter 21 - Python Virtual Environments
    • Python’s venv Library
    • The virtualenv Package
    • Other Tools
    • Wrapping Up
    • Review Questions
  • Chapter 22 - Type Checking in Python
    • Pros and Cons of Type Hinting
    • Built-in Type Hinting / Variable Annotation
    • Collection Type Hinting
    • Hinting Values That Could be None
    • Type Hinting Functions
    • What To Do When Things Get Complicated
    • Classes
    • Decorators
    • Aliasing
    • Other Type Hints
    • Type Comments
    • Static Type Checking
    • Wrapping Up
    • Review Questions
  • Chapter 22 - Creating Multiple Threads
    • Pros of Using Threads
    • Cons of Using Threads
    • Creating Threads
    • Subclassing Thread
    • Writing Multiple Files with Threads
    • Wrapping Up
    • Review Questions
  • Chapter 24 - Creating Multiple Processes
    • Pros of Using Processes
    • Cons of Using Processes
    • Creating Processes with multiprocessing
    • Subclassing Process
    • Creating a Process Pool
    • Wrapping Up
    • Review Questions
  • Chapter 25 - Launching Subprocesses with Python
    • The subprocess.run() Function
    • The subprocess.Popen() Class
    • The subprocess.Popen.communicate() Function
    • Reading and Writing with stdin and stdout
    • Wrapping Up
    • Review Questions
  • Chapter 26 - Debugging Your Code with pdb
    • Starting pdb in the REPL
    • Starting pdb on the Command Line
    • Stepping Through Code
    • Adding Breakpoints in pdb
    • Creating a Breakpoint with set_trace()
    • Using the built-in breakpoint() Function
    • Getting Help
    • Wrapping Up
    • Review Questions
  • Chapter 27 - Learning About Decorators
    • Creating a Function
    • Creating a Decorator
    • Creating a Decorator with @
    • Creating a Decorator for Logging
    • Stacking Decorators
    • Passing Arguments to Decorators
    • Using a Class as a Decorator
    • Python’s Built-in Decorators
    • Python Properties
    • Wrapping Up
    • Review Questions
  • Chapter 28 - Assignment Expressions
    • Using Assignment Expressions
    • What You Cannot Do With Assignment Expressions
    • Wrapping Up
    • Review Questions
  • Chapter 29 - Profiling Your Code
    • Learning How to Profile with cProfile
    • Profiling a Python Script with cProfile
    • Working with Profile Data Using pstats
    • Other Profilers
    • Wrapping Up
    • Review Questions
  • Review Question Answer Key
    • Chapter 3 - Documenting Your Code
    • Chapter 4 - Numeric Types
    • Chapter 5 - Learning About Lists
    • Chapter 6 - Learning About Tuples
    • Chapter 7 - Learning About Dictionaries
    • Chapter 8 - Learning About Sets
    • Chapter 9 - Working with Strings
    • Chapter 10 - Boolean Operations and None
    • Chapter 11 - Conditional Statements
    • Chapter 12 - Learning About Loops
    • Chapter 13 - Python Comprehensions
    • Chapter 14 - Exception Handling
    • Chapter 15 - Working with Files
    • Chapter 17 - Functions
    • Chapter 18 - Classes
    • Chapter 19 - Introspection
    • Chapter 20 - Installing Packages with pip
    • Chapter 21 - Python Virtual Environments
    • Chapter 22 - Type Checking in Python
    • Chapter 23 - Creating Multiple Threads
    • Chapter 24 - Creating Multiple Processes
    • Chapter 25 - Launching Subprocesses with Python
    • Chapter 26 - Debugging Your Code
    • Chapter 27 - Learning About Decorators
    • Chapter 28 - Assignment Expressions
    • Chapter 29 - Profiling Your Code
    • Chapter 30 - An Introduction to Testing
    • Chapter 31 - Learning About the Jupyter Notebook

Authors have earned$8,945,133writing, publishing and selling on Leanpub,
earning 80% royalties while saving up to 25 million pounds of CO2 and up to 46,000 trees.

Learn more about writing on Leanpub

The Leanpub 45-day 100% Happiness Guarantee

Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers), EPUB (for phones and tablets) and MOBI (for Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses! Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks. Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. It really is that easy.

Learn more about writing on Leanpub