- Author: Jeffrey Elkner, Allen B. Downey, Chris Meyers, Brendan McCane, Iain Hewson, and Nick Meek
- Format: PDF
- Price: free
This is an open source introductory textbook to learn practical programming skills in the Python language. The textbook is meant as a first programming course and is tightly aligned with the University of Otago introductory programming course called Practical Programming.
This textbook is a modified version of "How to Think Like a Computer Scientist: Learning with Python 2nd Edition", by Jeffrey Elkner, Allen B. Downey and Chris Meyers
Chapters include:
- The way of the program
- Variables, expressions and statements
- Python built-ins (batteries included)
- Functions: part 1
- Functions: part 2
- Conditionals
- Fruitful functions
- Test driven development
- Strings part 1
- Files and modules
- Iteration: part 1
- Iteration: part 2
- Strings part 2
- Lists part 1
- Lists part 2
- Classes and objects
- Graphical user interface programming
- Case study: Catch
- Case study: Catch continued
- Dictionaries
- Tuples
- System programming
- Case study 2
- The last lecture
https://launchpad.net/practical-programming
- Author: Al Sweigart
- Format: PDF, online HTML
- Price: free ($25 for paperback version)
Invent Your Own Computer Games with Python is a free book that teaches you how to program in the Python programming language. Each chapter gives you the complete source code for a new game, and then teaches the programming concepts from the example.
It was written to be understandable by kids as young as 10 to 12 years old, although it is great for anyone of any age who has never programmed before.
This second edition has revised and expanded content, including using the Pygame library to make games with graphics, animation, and sound.
Chapters include:
- Installing Python
- The Interactive Shell
- Strings
- Guess the Number
- Jokes
- Dragon Realm
- Using the Debugger (new!)
- Flow Charts
- Hangman
- Tic Tac Toe
- Bagels
- Cartesian Coordinates
- Sonar
- Caesar Cipher
- Reversi
- AI Simulation
- Graphics and Animation
- Collision Detection and Input
- Sound and Images
- Dodger
- Differences between Python 2 and 3
- Statements, Functions, and Methods Reference
- Running Python Programs Without Python Installed
- Common Error Messages in Python
http://inventwithpython.com
- Author: Python Software Foundation
- Format: online HTML
- Price: free
This document describes how to write modules in C or C++ to extend the Python interpreter with new modules. Those modules can define new functions but also new object types and their methods. The document also describes how to embed the Python interpreter in another application, for use as an extension language. Finally, it shows how to compile and link extension modules so that they can be loaded dynamically (at run time) into the interpreter, if the underlying operating system supports this feature.
This document assumes basic knowledge about Python.
Chapters include:
- Extending Python with C or C++
- A Simple Example
- Intermezzo: Errors and Exceptions
- Back to the Example
- The Module’s Method Table and Initialization Function
- Compilation and Linkage
- Calling Python Functions from C
- Extracting Parameters in Extension Functions
- Keyword Parameters for Extension Functions
- Building Arbitrary Values
- Reference Counts
- Writing Extensions in C++
- Providing a C API for an Extension Module
- Defining New Types
- The Basics
- Type Methods
- Building C and C++ Extensions with distutils
- Distributing your extension modules
- Building C and C++ Extensions on Windows
- A Cookbook Approach
- Differences Between Unix and Windows
- Using DLLs in Practice
- Embedding Python in Another Application
- Very High Level Embedding
- Beyond Very High Level Embedding: An overview
- Pure Embedding
- Extending Embedded Python
- Embedding Python in C++
- Linking Requirements
http://docs.python.org/extending/index.html
- Author: Arkon
- Format: online HTML
- Price: free
The primary focus is on embedding Python in your applications, to allow it to be user scriptable. This tutorial will show you how to use Python’s C API, and shares tips & tricks the author has learned from his own experiences with embedding Python.
Chapters include:
- It’s Everything About Objects
- Py_INCREF and Py_DECREF to Our Call
- My First Embedded Python Application
- Running some Strings
- Extension Modules
- Building and Parsing Arguments
- The None Object
- Exceptions
- Logging Stdout
- Files
- Lists/Tuples
- Callbacks
- Setting up your own scripting console
http://www.ragestorm.net/tutorial?id=21
- Author: Jason R. Briggs
- Format: PDF
- Price: free
Specifically for teaching kids ages 8 and older how to program, using Python.
This one is meant to be printed out and stapled together and given to your child as a gift.
It comes in 3 different flavors (Mac, Linux, Windows) and 2 different versions (for Python 3 & Python 2).
It is an ongoing work, and is updated as needed. If your child has difficulty understanding anything in the book, contact the author and let him know, so he can improve it.
Contents include:
- Not all snakes will squish you
- A Few Words About Language
- The Order of Non-venomous Constricting Serpentes
- Your First Python program
- Your Second Python program. . .the same again?
- multiplied by 3.57 equals
- Use of brackets and “Order of Operations”
- There’s nothing so fickle as a variable
- Using Variable
- A Piece of String?
- Tricks with Strings
- Not quite a shopping list
- Tuples and Lists
- Things to try
- Turtles, and other slow moving creatures
- Things to try
- How to ask a question
- Do this. . . or ELSE!!!
- Do this. . . or do this. . . or do this. . . or ELSE!!!
- Combining conditions
- Emptiness
- What’s the difference. . .?
- Again and again
- When is a block not square?
- While we’re talking about looping
- Things to try
- Sort of like recycling
- Bits and Pieces
- Modules
- Things to try
- A short chapter about Files
- Turtles galore
- Colouring in
- Darkness
- Filling things
- Things to try
- A bit graphic
- Quick Draw
- Simple Drawing
- Drawing Boxes
- Drawing Arcs
- Drawing Ovals
- Drawing Polygons
- Drawing Images
- Basic Animation
- Reacting to events
- Where to go from here
- Python Keywords
- Built-in Functions
- A Few Python Modules
- Answers to “Things to try”
http://www.briggs.net.nz/log/writing/snake-wrangling-for-kids/