Last year I wrote a toy bitcoin-like python implementation for the Systems and Network Security course. This year I found a much nicer toy implementation called dumbcoin, written by Julien Rebetez. His implementation is much cleaner than mine, and includes several classes for transactions, wallets, and blocks. He illustrates mining and validating transactions.