Python Crash Course

Python Crash Course

A Hands-On, Project-Based Introduction to Programming
by Eric Matthes
November 2015, 560 pp.

Take 30% off with the coupon code CRASHCOURSE.

Learn Python—Fast!

Python Crash Course is a fast-paced, thorough introduction to Python that will have you writing programs, solving problems, and making things that work in no time.

In the first half of the book, you’ll learn about basic programming concepts, such as lists, dictionaries, classes, and loops, and practice writing clean and readable code with exercises for each topic. You’ll also learn how to make your programs interactive and how to test your code safely before adding it to a project. In the second half of the book, you’ll put your new knowledge into practice with three substantial projects: a Space Invaders–inspired arcade game, data visualizations with Python’s super-handy libraries, and a simple web app you can deploy online.

As you work through Python Crash Course you’ll learn how to:

  • Use powerful Python libraries and tools, including matplotlib, NumPy, and Pygal
  • Make 2D games that respond to keypresses and mouse clicks, and that grow more difficult as the game progresses
  • Work with data to generate interactive visualizations
  • Create and customize Web apps and deploy them safely online
  • Deal with mistakes and errors so you can solve your own programming problems

If you’ve been thinking seriously about digging into programming, Python Crash Course will get you up to speed and have you writing real programs fast. Why wait any longer? Start your engines and code!

Uses Python 2 and 3

Author Bio 

Eric Matthes is a high school science and math teacher living in Alaska where he teaches Introduction to Python. He has been writing programs since he was five years old.

Table of contents 


PART I: Basics

Chapter 1: Getting Started
Chapter 2: Variables and Simple Data Types
Chapter 3: Introducing Lists
Chapter 4: Working with Lists
Chapter 5: if Statements
Chapter 6: Dictionaries
Chapter 7: User Input and while Loops
Chapter 8: Functions
Chapter 9: Classes
Chapter 10: Files and Exceptions
Chapter 11: Testing Your Code

PART II: Projects

Project 1: Alien Invasion
Chapter 12: A Ship that Fires Bullets
Chapter 13: Aliens!
Chapter 14: Scoring

Project 2: Data Visualization
Chapter 15: Generating Data
Chapter 16: Downloading Data
Chapter 17: Working with APIs

Project 3: Web Applications
Chapter 18: Getting Started with Django
Chapter 19: User Accounts
Chapter 20: Styling and Deploying an App


Appendix A: Installing Python
Appendix B: Text Editors
Appendix C: Getting Help
Appendix D: Using Git for Version Control

View the detailed Table of Contents (PDF)
View the Index (PDF)


Python Crash Course was selected as one of the best books for learning Python by Real Python

“It has been interesting to see, over the last few years, No Starch Press, which produces this book, growing and producing future classics that should be alongside the more traditional O’Reilly Press programming books. Python Crash Course is one of those books.”
Greg Laden, ScienceBlogs

Recommended reading for a “shining tech career” by Techradar India

“All of these projects are well thought out and presented in such a way that learning the subject matter and implementing it is much more an enjoyable pastime rather than an onerous task that must be completed. Eric took the time to deal with some rather complex projects and lay them out in a consistent, logical and pleasant manner that draws the reader into the subject willingly, which unfortunately, many authors fail to do.”
Full Circle Magazine

“The book is well presented with good explanations of the code snippets. It works with you, one small step at a time, building more complex code, explaining what's going on all the way.”
FlickThrough Reviews

“Learning Python with Python Crash Course was an extremely positive experience! A great choice if you’re new to Python.”
Mikke Goes Coding


Page 100: The line that reads:

alien_0['speed'] = fast

Should instead read:

alien_0['speed'] = 'fast'

Page 175: The line that reads:

def ElectricCar(Car):

Should instead read:

class ElectricCar(Car):

And the line that reads:

def fill_gas_tank():

Should instead read:

def fill_gas_tank(self):

Page 180: In, the line that reads:

def __init__(self, battery_size=60):

Should instead read:

def __init__(self, battery_size=70):

Page 207: In "Try It Yourself" 10-6, TypeError should be ValueError.

Page 223: In the listing, in the definition marked with a (2), the line that reads:


Should instead read:


And in the definition marked with a (4), the line that reads:

for response in responses:

Should instead read:

for response in self.responses:

Page 227: The paragraph that begins "The method setUp()..." that ends with:

...and test_store_single_response() verifies that all three responses in self.responses can be stored correctly.

Should instead end with:

...and test_store_three_responses() verifies that all three responses in self.responses can be stored correctly.

Page 288: In, the line that reads:

def __init__(self, settings):

Should instead read:

def __init__(self, ai_settings):

Pages 429 and 453: The line that reads:

form = TopicForm(request.POST)

Should instead read:

form = TopicForm(data=request.POST)

You'll find more updates at the author's website here