Every year at the end of freshman orientation, incoming CWRU students get to attend a “Saturday College” (SatCo) of their choice. They are opportunities to learn something new and exciting before getting into the daily grind of “real classes”. Student organizations have historically led their own SatCos to advertise themselves to the incoming freshmen. Today, Hacker’s Society led our very own SatCo, Python and Pie!
Andrew Mason and I co-taught a sparse (but experienced) group of freshmen the basics of Python, and moved on to showing them one cool use of Python: writing a Twitter bot! We even moved on and discussed how Python can be used to do web scraping and efficiently compute factorials. All of this as we shared 16 delicious pies provided generously by Hacker’s Society!
If you missed it, you can see the code for my example Twitter bot,
github (complete with a brief
tutorial). Its depressing existence consists of waiting to be tweeted at, and
once it has been, replying back with a randomly chosen Taylor Swift lyric. You
can also see the module I wrote to download all of Taylor Swift’s (or any other
artist’s) lyrics here. It’s also
available on PyPI – just run
Update: The bot has been renamed to @pyswizzle on Twitter (the link is updated in the body of the article). There is also a new version of the code on GitHub, but the old version (still in the body of the article) is still available, complete with the original tutorial.
Update 2: Check out the slides here!