Python Books

Study Python with Free Open-Source Books

Invent your Own Computer Games with Python

Invent Your Own Computer Games with Python

By Al Sweigart (438 pages)

Invent Your Own Computer Games with Python teaches you how to program by making video games. Each chapter gives you the complete source code for a new game and teaches the programming concepts from these examples. Invent with Python was written to be understandable by kids as young as 10 to 12 years old, although it is suitable for any age.

This second edition has revised and expanded content, including using the Pygame library to make games with graphics, animation, and sound.

The book focuses on three different areas:

  • Series of tutorials ranging from a simple “guess the number” game, to drawing game boards with ASCII art, reversi, and simple artificial intelligence simulation
  • Make the design for a Hangman game
  • Learn new methods and functions that come with Python
  • Simple mathematical concepts including Cartesian coordinate systems, X-axis and Y-axis, the commutative property of addition, and absolute values and the abs () function
  • Use the Pygame library to make games with graphics, animation, mouse input, and sound
  • Make graphical user interface programs that have graphics and can accept input from the keyboard and mouse

The programs in the book use Python 3.

The book is available under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 license.

Snake Wrangling for Kids

Snake Wrangling for Kids

By Jason R. Briggs (160 pages)

Snake Wrangling for Kids is a printable electronic book, for children 8 years and older, who would like to learn computer programming. It covers the very basics of programming, and uses the Python 3 programming language to teach the concepts.

There are 3 different versions of the free book (one for Mac, one for Linux and one for Windows). It has been rewritten and updated, with new chapters (including developing graphical games), and new code examples

  • Use fundamental data structures like lists, tuples, and maps
  • Organize and reuse your code with functions and modules
  • Use control structures like loops and conditional statements
  • Draw shapes and patterns with Python’s turtle module
  • Create games, animations, and other graphical wonders with Tkinter

This version is licensed under the Creative Commons license.

Make Games with Python

Make Games with Python

By Sean M. Tracey (154 pages)
This book aims to teach you the essential skills you’ll need to make games with Python and Pygame on a Raspberry Pi. Drawing, animation, keyboard and mouse controls, sound, and physics are given good treatment.

Chapters cover:

  • Shapes and paths with Pygame – looks at drawing and coloring various shapes in a window
  • Animating shapes and paths – learn how to move shapes around the screen
  • Taking control of the keyboard and mouse – makes two simple programs to learn how to use the keyboard and mouse
  • Your first game – an old-school drop-down game where platforms rise up from the floor
  • Pygame soundboard – learn about loading and playing sounds in Pygame projects
  • Physics and forces – give game objects mass, and apply gravity
  • Physics & Collisions – create circles which can bounce off one another on collision
  • Building classes – make a simple barrel-dodging game using classes
  • The Aliens are trying to kill me – applying the techniques learned in the earlier chapters, this chapter sets out the first half of the space shooter game
  • The aliens are here & they’re coming in waves! – adds polish to the space shooter game with shields to the spaceship and a simple health/shield bar to show their status. Levels and waves for enemy spaceships are also added

Make Games with Python is published under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License (CC BY-NC-SA 3.0).

Making Games with Python & Pygame

Making Games with Python & Pygame

By Al Sweigart (366 pages)

This book teaches you how to make graphical computer games in the Python programming language using the Pygame library. It is targeted at the intermediate programmer.

The book features the source code to 11 games. Each chapter focuses on a single game program, explaining how different parts of the code work. The games are clones of classics such as Nibbles, Tetris, Simon, Bejeweled, Othello, Ink Spill, Connect Four, Flood It, and others. The programs are less than 600 lines long.

The book and the programs are available under a Creative Commons Attribution-Noncommercial-Share Alike license.

Natural Language Processing with Python

Natural Language Processing with Python

By Steven Bird, Ewan Klein, Edward Loper (500 pages)

Natural Language Processing with Python offers a highly accessible introduction to natural language processing, the field that supports a variety of language technologies, from predictive text and email filtering to automatic summarization and translation.

Learn how to write Python programs that work with large collections of unstructured text. Access richly annotated datasets using a comprehensive range of linguistic data structures, and understand the main algorithms for analyzing the content and structure of written communication.

The book is updated for Python 3 and NLTK 3.

This book helps to:

  • Extract information from unstructured text, either to guess the topic or identify “named entities”
  • Analyze linguistic structure in text, including parsing and semantic analysis
  • Access popular linguistic databases, including WordNet and treebanks
  • Integrate techniques drawn from fields as diverse as linguistics and artificial intelligence

This book is made available under the terms of the Creative Commons Attribution Noncommercial No-Derivative-Works 3.0 US License.

Problem Solving with Algorithms and Data Structures using Python

Problem Solving with Algorithms and Data Structures using Python

By Bradley M. Kuhn (66 pages)

This textbook is designed to serve as a text for a first course on data structures and algorithms, typically taught as the second course in the computer science curriculum.

The objectives of this book are:

  • To review the ideas of computer science, programming, and problem-solving
  • To understand abstraction and the role it plays in the problem-solving process
  • To understand and implement the notion of an abstract data type
  • To review the Python programming language
    • Getting started with data
      • Built-in atomic data types
      • Built-in collection data types
    • Input and output
      • String formatting
    • Control structures
    • Exception handling
    • Defining functions
    • Object-oriented programming in Python
  • Discussion questions
  • Programming exercises

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version.

Think DSP

Think DSP

By Allen B. Downey (164 pages)

Think DSP is an introduction to Digital Signal Processing in Python and includes processes for synthesizing, transforming, and analyzing signals. All of the code is written to work in both Python 2 and Python 3 with no translation.

Permission is granted to copy, distribute, and/or modify this book under the terms of the Creative Commons Attribution-NonCommercial 3.0 Unported License.

Python for Everybody

Python for Everybody: Exploring Data in Python 3

By Charles Severance (242 pages)

The goal of this book is to provide an Informatics-oriented introduction to programming. The primary difference between a computer science approach and the Informatics approach taken in this book is a greater focus on using Python to solve data analysis problems common in the world of Informatics.

The book is available to download in PDF, EPUB and HTML in a ZIP file. You can purchase a printed copy and a Kindle edition is also available.

There is also a Python 2 version available.

This work is licensed under a Creative Commons Attribution-NonCommercial- ShareAlike 3.0 Unported License.

Hacking Secret Ciphers with Python

Hacking Secret Ciphers with Python

By Al Sweigart (436 pages)

Hacking Secret Ciphers with Python teaches complete beginners how to write cipher programs and hacking programs that can break encrypted messages from these ciphers, using Python programming language.

The book features the source code to several ciphers and hacking programs for these ciphers. The programs include the Caesar cipher, transposition cipher, simple substitution cipher, multiplicative & affine ciphers, Vigenere cipher, and hacking programs for each of these ciphers. The final chapters cover the modern RSA cipher and public key cryptography.

Hacking Secret Ciphers with Python is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.

Back to First Page

Proceed to Third Page


Ada, Assembly, Awk, Bash, C, C++, C#, Clojure, CoffeeScript, ECMAScript, Erlang, Forth, Fortran, Go, Haskell, HTML, Java, JavaScript, LaTeX, Lisp, Logo, Lua, OCaml, Pascal, Perl, PHP, Prolog, Python, R, Ruby, Rust, Scala, Scheme, Scratch, SQL, Swift, TeX, VimL

Pages: 1 2 3


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.