Yesterday was pretty eventful programming wise. I decided to resume working on the library-lookup module I created 5 months ago. The goal of the module is to query the Goodreads API for a list of books marked “to-read” by the user, then check to see if any of them are available in my local library’s […]
Markov Analysis
Here is a fun little class I threw together this week while finishing up with Think Python. It scans text files from Project Gutenberg to generate a dictionary that maps each word (and sets of two consecutive words) in the book to the word immediately following it. It then uses this dictionary to generate a […]
Finding list combinations recursively
I’ve spent the past few hours trying to find a way to recursively search a list for all possible combinations of size n and I think I finally have it: def combinations(n, list, combos=[]): # initialize combos during the first pass through if combos is None: combos = [] if len(list) == n: # when […]
Scaffolding
Just ran across this line in Think Python: How to Think Like a Computer Scientist: The print statements we wrote are useful for debugging, but once you get the function working, you should remove them. Code like that is called scaffolding because it is helpful for building the program but is not part of the […]
Achievement Unlocked: CodingBat
Just a quick update on what I’ve been up to lately. In my attempt to brush up on Python, I spent my free time over the past few days working my way through all of the problems at CodingBat. The problems were pretty simple, but they provided a nice refresher on working with lists and […]