Programming Books

46 Excellent Free Books to Learn Python

11. Invent Your Own Computer Games with Python by Al Sweigart

Invent Your Own Computer Games with PythonInvent 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.

Read the book

12. Test-Driven Development with Python: Obey the Testing Goat: Using Django, Selenium, and JavaScript by Harry Percival

Test-Driven Development with Python: Obey the Testing Goat: Using Django, Selenium, and JavaScriptBy taking you through the development of a real web application from beginning to end, the second edition of this hands-on guide demonstrates the practical advantages of test-driven development (TDD) with Python. You’ll learn how to write and run tests before building each part of your app, and then develop the minimum amount of code required to pass those tests. The result? Clean code that works.

In the process, you’ll learn the basics of Django, Selenium, Git, jQuery, and Mock, along with current web development techniques. If you’re ready to take your Python skills to the next level, this book—updated for Python 3.6—clearly demonstrates how TDD encourages simple designs and inspires confidence.

  • Dive into the TDD workflow, including the unit test/code cycle and refactoring.
  • Use unit tests for classes and functions, and functional tests for user interactions within the browser.
  • Learn when and how to use mock objects, and the pros and cons of isolated vs. integrated tests.
  • Test and automate your deployments with a staging server.
  • Apply tests to the third-party plugins you integrate into your site.
  • Run tests automatically by using a Continuous Integration environment.
  • Use TDD to build a REST API with a front-end Ajax interface.

The book is published under a Creative Commons license.

Read the book

13. Python Data Science Handbook by Jake VanderPlas

Python Data Science HandbookWorking scientists and data crunchers familiar with reading and writing Python code will find this comprehensive desk reference ideal for tackling day-to-day issues: manipulating, transforming, and cleaning data; visualizing different types of data; and using data to build statistical or machine learning models.

This is an excellent reference for scientific computing in Python.

With this handbook, you’ll learn how to use:

  • IPython and Jupyter: provide computational environments for data scientists using Python.
  • NumPy: includes the ndarray for efficient storage and manipulation of dense data arrays in Python.
  • Pandas: features the DataFrame for efficient storage and manipulation of labeled/columnar data in Python.
  • Matplotlib: includes capabilities for a flexible range of data visualizations in Python.
  • Scikit-Learn: for efficient and clean Python implementations of the most important and established machine learning algorithms.

Read the book

14. Snake Wrangling for Kids by Jason R. Briggs

Snake Wrangling for KidsSnake 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.

The author no longer distributes the book.

Read the book

15. Make Games with Python by Sean M. Tracey

Make Games with Python

Make Games with Python 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.

Although this book is designed to help you learn many of the essential skills you’ll need to make games with Python and Pygame on your Raspberry Pi, it’s by no means a definitive guide.

Read this book in conjunction with some of the books on the first page.

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).

Read the book

Next page: Page 4 – Making Games with Python & Pygame and more books

Pages in this article:
Page 1 – Think Python and more books
Page 2 – Supporting Python 3 and more books
Page 3 – Invent Your Own Computer Games with Python and more books
Page 4 – Making Games with Python & Pygame and more books
Page 5 – Hacking Secret Ciphers with Python and more books
Page 6 – How to Make Mistakes in Python and more books
Page 7 – Text Processing in Python and more books
Page 8 – The Coder’s Apprentice and more books
Page 9 – Building Skills in Object-Oriented Design and more books

All books in this series:

Free Programming Books
AdaALGOL-like programming language, extended from Pascal and other languages
AgdaDependently typed functional language based on intuitionistic Type Theory
ArduinoInexpensive, flexible, open source microcontroller platform
AssemblyAs close to writing machine code without writing in pure hexadecimal
AwkVersatile language designed for pattern scanning and processing language
BashShell and command language; popular both as a shell and a scripting language
BASICBeginner’s All-purpose Symbolic Instruction Code
CGeneral-purpose, procedural, portable, high-level language
C++General-purpose, portable, free-form, multi-paradigm language
C#Combines the power and flexibility of C++ with the simplicity of Visual Basic
ClojureDialect of the Lisp programming language
ClojureScriptCompiler for Clojure that targets JavaScript
COBOLCommon Business-Oriented Language
CoffeeScriptTranscompiles into JavaScript inspired by Ruby, Python and Haskell
CoqDependently typed language similar to Agda, Idris, F* and others
CrystalGeneral-purpose, concurrent, multi-paradigm, object-oriented language
CSSCSS (Cascading Style Sheets) specifies a web page’s appearance
DGeneral-purpose systems programming language with a C-like syntax
DartClient-optimized language for fast apps on multiple platforms
DylanMulti-paradigm language supporting functional and object-oriented coding
ECMAScriptBest known as the language embedded in web browsers
EiffelObject-oriented language designed by Bertrand Meyer
ElixirRelatively new functional language running on the Erlang virtual machine
ErlangGeneral-purpose, concurrent, declarative, functional language
F#Uses functional, imperative, and object-oriented programming methods
FactorDynamic stack-based programming language
ForthImperative stack-based programming language
FortranThe first high-level language, using the first compiler
GoCompiled, statically typed programming language
GroovyPowerful, optionally typed and dynamic language
HaskellStandardized, general-purpose, polymorphically, statically typed language
HTMLHyperText Markup Language
IconWide variety of features for processing and presenting symbolic data
JArray programming language based primarily on APL
JavaGeneral-purpose, concurrent, class-based, object-oriented, high-level language
JavaScriptInterpreted, prototype-based, scripting language
JuliaHigh-level, high-performance language for technical computing
KotlinMore modern version of Java
LabVIEWDesigned to enable domain experts to build power systems quickly
LaTeXProfessional document preparation system and document markup language
LispUnique features - excellent to study programming constructs
LogoDialect of Lisp that features interactivity, modularity, extensibility
LuaDesigned as an embeddable scripting language
MarkdownPlain text formatting syntax designed to be easy-to-read and easy-to-write
Objective-CObject-oriented language that adds Smalltalk-style messaging to C
OCamlThe main implementation of the Caml language
PascalImperative and procedural language designed in the late 1960s
PerlHigh-level, general-purpose, interpreted, scripting, dynamic language
PHPPHP has been at the helm of the web for many years
PostScriptInterpreted, stack-based and Turing complete language
PrologA general purpose, declarative, logic programming language
PureScriptSmall strongly, statically typed language compiling to JavaScript
PythonGeneral-purpose, structured, powerful language
QMLHierarchical declarative language for user interface layout - JSON-like syntax
RDe facto standard among statisticians and data analysts
RacketGeneral-purpose, object-oriented, multi-paradigm, functional language
RakuMember of the Perl family of programming languages
RubyGeneral purpose, scripting, structured, flexible, fully object-oriented language
RustIdeal for systems, embedded, and other performance critical code
ScalaModern, object-functional, multi-paradigm, Java-based language
SchemeA general-purpose, functional language descended from Lisp and Algol
ScratchVisual programming language designed for 8-16 year-old children
SQLAccess and manipulate data held in a relational database management system
Standard MLGeneral-purpose functional language characterized as "Lisp with types"
SwiftPowerful and intuitive general-purpose programming language
TclDynamic language based on concepts of Lisp, C, and Unix shells
TeXMarkup and programming language - create professional quality typeset text
TypeScriptStrict syntactical superset of JavaScript adding optional static typing
ValaObject-oriented language, syntactically similar to C#
VHDLHardware description language used in electronic design automation
VimLPowerful scripting language of the Vim editor
XMLRules for defining semantic tags describing structure ad meaning
Share this article

Share your Thoughts

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