I’ve been meaning for a while to get round to making some business cards to hand out to folks who ask me about learning to program. Normally I just tell people to google “python for biologists” and they’ll end up in the right place, but it would be nice to have a physical reminder to give out. At first I though about having some USB memory stick business cards made – there are some really cool ones that are the shape of a normal business card but can fold in half to reveal a set of USB contacts. Unfortunately they’re way expensive, and the minimum order is far more than I need.
Next I thought about making a “cheat sheet” style business card – the type with contact information on the front and some useful quick-reference information (e.g. a list of regular expression characters) on the back. I guess the idea would be that the recipient is more likely to hang onto the card if it has useful information on it. But I couldn’t think of anything that would fit in well with my website – after all, the emphasis of pythonforbiologists is on learning to program, not simply the practice of programming itself.
Finally, I had an idea; I would put a tiny biology-themed programming exercise on the back of each of my business cards, along with a link to a web page giving the solution.
This would hopefully mean that when somebody gets hold of one of my cards they can see straight away what kind of material and training I provide, and can head over to the website for more information. I wrote five different nano-exercises on five different biological topics:
- parsing FASTQ file format
- counting the number of occurrences of short motifs in DNA sequences
- calculating AT content using a sliding window
- generating the reverse complement of a DNA sequence
- calculating restriction fragment lengths
Fitting the sample code onto the business cards was quite difficult. I wanted to make sure that the code would be readable and not too hard to understand – I even found room for a few comments – but it also had to be very concise. I only had about ten lines to work with, so I had to use very short variable names.
You can see images of all the reverse sides at this link.
After I’d designed the code samples and exercises I wrote web pages for each of the solutions. I decided to put the exercise description and the link to the solution pages on the front of the card, as I’d used up all the room on the back with the code samples.
I tried to make each solution page interesting to read. As well as giving an answer to the exercise, I included extra material about useful bits of the Python language that some people don’t know about. For example, in the solution page to the FASTQ parser exercise I talked about generator functions, and in the sliding window exercise solution I talked about higher-order functions.
You can browse all of the exercises along with links to their solution pages here. Comments appreciated!