Green Eggs and Ham by Dr. Seuss

Dr. Seuss’ Green Eggs and Ham has exactly 50 unique words.

I became interested in this fact after reading an article stating Dr. Seuss took on a bet to write Green Eggs and Ham in 50 words or less. I wanted to confirm this for myself so I thought that I would write a quick Python script to do it.

So, I found a text file version of Green Eggs and Ham and downloaded it, then dumped it into a Python script that determines how many unique words there are. After correcting the script text file to match exactly what the book says (i.e. removing the word “spam” which doesn’t actually occur in the book) and removing hyphens, other punctuation, and ignoring case, I managed to confirm for myself that Green Eggs and Ham does in fact have exactly fifty words.

Mystery solved!

The script’s output is:

set(['and', 'sam', 'be', 'house', 'am', 'box', 'see', 'are', 'in', 'mouse', 'boat', 'if', 'try', 'ham', 'would', 'there', 'fox', 'so', 'you', 'goat', 'do', 'them', 'good', 'that', 'may', 'eggs', 'here', 'dark', 'me', 'train', 'let', 'rain', 'they', 'not', 'with', 'eat', 'thank', 'a', 'on', 'like', 'i', 'car', 'could', 'tree', 'say', 'will', 'anywhere', 'green', 'the', 'or'])
50

Leave a reply

required