Python Crash Course: A Hands-On, Project-Based Introduction to Programming

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

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(s): Eric Matthes
Edition: 2
Publisher: No Starch Press
Year: 2015

Language: English
Pages: 560

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