Python Crash Course

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


Introduction

Who Is This Book For? 
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 programmed in Python before or have never programmed at all. If you want to learn the basics of programming quickly so you can focus on interesting projects, and you like to test your understanding of new concepts by solving meaningful problems, this book is for you. 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

Part I Basics
Part I of this book teaches you the basic concepts you’ll need to write Python programs. Many of these concepts are common to all programming languages, so they’ll be useful throughout your life as a programmer.

In Chapter 1 you’ll install Python on your computer and run your first program, which prints the message Hello world! to the screen.

In Chapter 2 you’ll learn to store information in variables and work with text and numerical values.

Chapters 3 and 4 introduce lists. Lists can store as much information as you want in one variable, allowing you to work with that data efficiently. You’ll be able to work with hundreds, thousands, and even millions of values in just a few lines of code.

In Chapter 5 you’ll use if statements to write code that responds one way if certain conditions are true, and responds in a different way if those conditions are not true.

Chapter 6 shows you how to use Python’s dictionaries, which let you make connections between different pieces of information. Like lists, dictionaries can contain as much information as you need to store.

In Chapter 7 you’ll learn how to accept input from users to make your programs interactive. You’ll also learn about while loops, which run blocks of code repeatedly as long as certain conditions remain true.

In Chapter 8 you’ll write functions, which are named blocks of code that perform a specific task and can be run whenever you need them.

Chapter 9 introduces classes, which allow you to model real-world objects, such as dogs, cats, people, cars, rockets, and much more, so your code can represent anything real or abstract.

Chapter 10 shows you how to work with files and handle errors so your programs won’t crash unexpectedly. You’ll store data before your program closes, and read the data back in when the program runs again. You’ll learn about Python’s exceptions, which allow you to anticipate errors, and make your programs handle those errors gracefully.

In Chapter 11 you’ll learn to write tests for your code to check that your programs work the way you intend them to. As a result, you’ll be able to expand your programs without worrying about introducing new bugs. Testing your code is one of the first skills that will help you transition from beginner to intermediate programmer

Part II Projects
Congratulations! You now know enough about Python to start building interactive and meaningful projects. Creating your own projects will teach you new skills and solidify your understanding of the concepts introduced in Part I.

Part II contains three types of projects, and you can choose to do any or all of these projects in whichever order you like. Here’s a brief description of each project to help you decide which to dig into first.

Alien Invasion: Making a Game with Python
In the Alien Invasion project (Chapters 12, 13, and 14), you’ll use the Pygame package to develop a 2D game in which the aim is to shoot down a fleet of aliens as they drop down the screen in levels that increase in speed and difficulty. At the end of the project, you’ll have learned skills that will enable you to develop your own 2D games in Pygame.

Data Visualization 
The Data Visualization project starts in Chapter 15, in which you’ll learn to generate data and create a series of functional and beautiful visualizations of that data using matplotlib and Pygal. Chapter 16 teaches you to access data from online sources and feed it into a visualization package to create plots of weather data and a world population map. Finally, Chapter 17 shows you how to write a program to automatically download and visualize data. Learning to make visualizations allows you to explore the field of data mining, which is a highly sought-after skill in the world today.

Web Applications
In the Web Applications project (Chapters 18, 19, and 20), you’ll use the Django package to create a simple web application that allows users to keep a journal about any number of topics they’ve been learning about. Users will create an account with a username and password, enter a topic, and then make entries about what they’re learning. You’ll also learn how to deploy your app so anyone in the world can access it. After completing this project, you’ll be able to start building your own simple web applications, and you’ll be ready to delve into more thorough resources on building applications with Django.

Share This