Python Crash Course, 2nd Edition

Python Crash Course, 2nd Edition

A Hands-On, Project-Based Introduction to Programming
by Eric Matthes
May 2019, 544 pp.
ISBN-13: 
9781593279288
This book is currently out of stock, but the ebook is still available

Look Inside!

Python Crash Course, 2nd EditionPython Crash Course, 2nd EditionPython Crash Course, 2nd EditionPython Crash Course, 2nd EditionPython Crash Course, 2nd EditionPython Crash Course, 2nd Edition

Featured in I Programmer's Book Watch. Staff pick in Any New Books.

"With a patient and experienced pedagogical style, and a combination of thorough language instruction and plenty of illustrative sample code, Python Crash Course is a terrific way to begin learning computer programming in general and the Python language in particular."
Michael J. Ross, web developer and former Slashdot contributor.

"While Python Crash Course uses Python to teach you to code, it also teaches clean programming skills that apply to most other languages."
—Great Lakes Geek

Download Chapter 2: Variables and Simple Data Types

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

Download Resources

Visit the author's websites below for code files, images, updated libraries, and other resources.

Click here for the 2nd Edition

Click here for the 1st Edition

Author Bio 

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

Table of contents 

Preface to the Second Edition
Introduction

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

Afterword

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
View the Index

Reviews 

Featured in I Programmer's Book Watch. Staff pick in Any New Books.

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

"With a patient and experienced pedagogical style, and a combination of thorough language instruction and plenty of illustrative sample code, Python Crash Course is a terrific way to begin learning computer programming in general and the Python language in particular."
Michael J. Ross, web developer and former Slashdot contributor.

“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

“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

"While Python Crash Course uses Python to teach you to code, it also teaches clean programming skills that apply to most other languages."
—Great Lakes Geek

Extra Stuff 

Visit the author's websites below for code files, images, updated libraries, and other resources.

Click here for the 2nd Edition

Click here for the 1st Edition

Updates 

Page 100: The last code listing, which read:
Key: last
Value: fermi

Key: first
Value: enrico

Key: username
Value: efermi

Should instead read:
Key: username
Value: efermi

Key: first
Value: enrico

Key: last
Value: fermi

Page 102: In the fourth code listing, the line that read:
print(name.title())

Should read:
print(f"Hi {name.title()}.")

Page 104: In the second code listing, the fourth and fifth lines, which read:
Python
Ruby

Should read:
Ruby
Python

Page 107: In the first code listings, all lines that read:
{'speed': 'slow', 'color': 'green', 'points': 5}

Should read:
{'color': 'green', 'points': 5, 'speed': slow'}

Page 108: In the first code listing, the first three lines, which read:
{'speed': 'medium', 'color': 'yellow', 'points': 10}

Should read:
{'color': 'yellow', 'points': 10, 'speed': 'medium'}

And the fourth and fifth lines, which read:
{'speed': 'slow', 'color': 'green', 'points': 5}

Should read:
{'color': 'green', 'points': 5, 'speed': 'slow'}

Page 109: In the first code listing, the last line, which read:
print("\t" + topping)

Should read:
print(f"\t{topping}")

Page 110: In the first code listing, the lines that read
Phil's favorite languages are:
    Python
    Haskell

Edward's favorite languages are:
    Ruby
    Go

Should read:
Edward's favorite languages are:
    Ruby
    Go

Phil's favorite languages are:
    Python
    Haskell

Page 125: The sentence in the first paragraph that read:
Within this loop, the pop() function at removes unverified users one at a time from the end of unconfirmed_users.

Should read:
Within this loop, the pop() method at removes unverified users one at a time from the end of unconfirmed_users.

Page 127: In the code listing, the lines that read:
--- Poll Results ---
Lynn would like to climb Devil's Thumb.
Eric would like to climb Denali.

Should read:
--- Poll Results ---
Eric would like to climb Denali.
Lynn would like to climb Devil's Thumb.

Page 163: In the first code listing, the sixth line, which read:
long_name = f"{self.year} {self.manufacturer} {self.model}"

Should read:
long_name = f"{self.year} {self.make} {self.model}"

Page 168: In the code listing, the eleventh line, which read:
long_name = f"{self.year} {self.manufacturer} {self.model}"

Should read:
long_name = f"{self.year} {self.make} {self.model}"

Page 172: In the second code listing, the ninth line, which read:
if self.battery_size == 75:
Should be indented one extra space, so that it aligns with the quote above and the ‘elif’ below.

Page 174: In the code listing, the 15th line, which read:
long_name = f"{self.year} {self.manufacturer} {self.model}"

Should read:
long_name = f"{self.year} {self.make} {self.model}"

Page 176: In the first code listing, the ninth line, which read:
def __init__(self, battery_size=70):

Should read:
def __init__(self, battery_size=75):

Page 185: In the second code listing, which read:
with open('pi_digits.txt') as file_object:
    contents = file_object.read()
    print(contents.rstrip())

Should read:
with open('pi_digits.txt') as file_object:
    contents = file_object.read()

                        
print(contents.rstrip())

Page 262: The last code listing, which read:
number_rows = available_height_y // (2 * alien_height)

Should read:
number_rows = available_space_y // (2 * alien_height)

Page 323: The sentence in the Try It Yourself box that read:
Modify rw_visual.py by replacing plt.scatter() with plt.plot().

Should read:
Modify rw_visual.py by replacing ax.scatter() with ax.plot().

Page 337: In the first code listing, the lines that read:
plt.title("Daily high temperatures, July 2018", fontsize=24)
plt.xlabel('', fontsize=16)
plt.ylabel("Temperature (F)", fontsize=16)
plt.tick_params(axis='both', which='major', labelsize=16)

Should read:
ax.set_title("Daily high temperatures, July 2018", fontsize=24)
ax.set_xlabel('', fontsize=16)
ax.set_ylabel("Temperature (F)", fontsize=16)
ax.tick_params(axis='both', which='major', labelsize=16)

Also, the sentence that read:
Because we have yet to add the dates, we won’t label the x-axis, but plt.xlabel() does modify the font size to make the default labels more readable .

Should read:
Because we have yet to add the dates, we won’t label the x-axis, but ax.set_xlabel() does modify the font size to make the default labels more readable .

Page 339: In the code listing, the lines that read:
plt.title("Daily high temperatures, July 2018", fontsize=24)
plt.xlabel('', fontsize=16)
fig.autofmt_xdate()
plt.ylabel("Temperature (F)", fontsize=16)
plt.tick_params(axis='both', which='major', labelsize=16)

Should read:
ax.set_title("Daily high temperatures, July 2018", fontsize=24)
ax.set_xlabel('', fontsize=16)
fig.autofmt_xdate()
ax.set_ylabel("Temperature (F)", fontsize=16)
ax.tick_params(axis='both', which='major', labelsize=16)

Page 340: In the first code listing, the sixth and seventh lines, which read:
plt.title("Daily high temperatures - 2018", fontsize=24)
plt.xlabel('', fontsize=16)

Should read:
ax.set_title("Daily high temperatures - 2018", fontsize=24)
ax.set_xlabel('', fontsize=16)

Page 341: In the code listing, the line that read:
plt.title("Daily high and low temperatures - 2018", fontsize=24)

Should read:
ax.set_title("Daily high and low temperatures - 2018", fontsize=24)

Page 342: In the code listing, the line that read:
plt.fill_between(dates, highs, lows, facecolor='blue', alpha=0.1)

Should read:
ax.fill_between(dates, highs, lows, facecolor='blue', alpha=0.1)

Page 344: In the last code listing, the lines that read:
plt.title(title, fontsize=20)
plt.xlabel('', fontsize=16)

Should read:
ax.set_title(title, fontsize=20)
ax.set_xlabel('', fontsize=16)

Page 386: In the last code listing, the sixth line, which reads:
# Default django apps.
Should be indented one space, to match the indentation level of the line below.

Page 414: In the code listing, the 12th line, which read:
labels = {'text': 'Entry:'}

Should read:
labels = {'text': ' '}

Page 441: In the second code listing, the sixth line, which read:
<span class="navbar-text"}">Hello, {{ user.username }}.</span>

Should read:
<span class="navbar-text">Hello, {{ user.username }}.</span>

Page 458: In the first code listing, the first line, which read:
(ll_env)learning_log$ heroku config:set DEBUG='FALSE'

Should read:
(ll_env)learning_log$ heroku config:set DEBUG=FALSE