Python Crash Course - A Hands-On, Project-Based Introduction to Programming book
The goal of this book is to bring you up to speed with Python as quickly as
possible so you can build programs that work—games, data visualizations,
and web applications—while developing a foundation in programming
that will serve you well for the rest of your life. Python Crash Course is written
for people of any age who have never before programmed in Python or
have never programmed at all. This book is for those who want to learn the
basics of programming quickly so they can focus on interesting projects,
and those who like to test their understanding of new concepts by solving
meaningful problems. Python Crash Course is also perfect for middle school
and high school teachers who want to offer their students a project-based
introduction to programming. If you’re taking a college class and want a
friendlier introduction to Python than the text you’ve been assigned, this
book could make your class easier as well.
Part I: Basics 1
Chapter 1: Getting Started . 3
Chapter 2: Variables and Simple Data Types . 15
Chapter 3: Introducing Lists 33
Chapter 4: Working with Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Chapter 5: if Statements . 71
Chapter 6: Dictionaries 91
Chapter 7: User Input and while Loops 113
Chapter 8: Functions . 129
Chapter 9: Classes 157
Chapter 10: Files and Exceptions 183
Chapter 11: Testing Your Code 209
Part II: Projects . 223
Project 1: Alien Invasion
Chapter 12: A Ship that Fires Bullets . 227
Chapter 13: Aliens! . 255
Chapter 14: Scoring . 279
x Brief Contents
Project 2: Data Visualization
Chapter 15: Generating Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
Chapter 16: Downloading Data 333
Chapter 17: Working with APIs 359
Project 3: Web Applications
Chapter 18: Getting Started with Django . 379
Chapter 19: User Accounts 409
Chapter 20: Styling and Deploying an App . 437