My idea for this assignment was very stupid. It came from the fact that when typing “python” in the command line, I regularly accidentally type it as “pythong” instead.
So I decided to make a mashup of Sisqo’s 1999 classic, Thong Song, and some documentation from python.org.
I knew I wanted it to maintain the structure of the Thong Song, but with the flavor of Python documentation sprinkled throughout.
What I ended up doing was making two source files, thong-song.txt (which had the lyrics) and python.txt (which included a chunk of documentation text). I then replaced one random word in each song line with a random word from the Python text.
I quickly ran into the problem of the program picking words from python.txt that were not very useful to me, like “the” or “it” or “a.” So to solve this problem, I made another file with a list of “boring words,” and I told it to only select a word from python.txt if it was not also in boring.txt:
use_these = [i for i in line.split() if not i.lower() in boring_words]
for individual_word in use_these:
And of course, I also changed every instance of the word “thong” or “Python” to the word “Pythong.”
When I run the program, it’s different each time with varying degrees of success. I think it works best when the song still generally rhymes (so in most cases, if the last word on each line is not changed). I also experimented with trying to get it to only replace each word with a word that began with the same letter, but I couldn’t quite get it to work in time, and I’m not sure it would actually make much of an improvement. Anyway, a couple ideas for building this program further.
Code and text files below, including a full sample of the results: