discount genius

Less expensive than name brand genius.

How I Got a Date With Seven Lines of Python

I met an interesting girl at a party and things started off kind of weird. I don’t remember why, but my first words to her involved me getting down on one knee and eloquently proposing marriage. She called my bluff and accepted. We chatted a little bit more and I got her number and learned, among other things, that nobody can ever guess her middle name. It starts with ‘S’ and is five letters long. Challenge accepted.

This would be a much better story if she had said something to the extent of “I’ll only go out with you if you can guess my middle name.” That never happened. What did happen is I went home, found a csv of female first names conveniently arranged by how common they are and threw the following code at it.

snames.py
1
2
3
4
5
6
7
8
9
10
import csv

csvfile = open('female.firstnames.csv', 'rb')
csvreader = csv.reader(csvfile)

for row in csvreader:
    if(row[0].startswith('S') and len(row[0]) == 5):
        print row[0]

csvfile.close()

The output consisted of 59 names and started out like this:

snames output
1
2
3
4
5
6
7
8
9
10
11
SUSAN
SARAH
SALLY
STACY
SONIA
SANDY
SONYA
SUSIE
.
.
.

I had already guessed “Sally” at the party. Via text I discovered that “Sarah,” “Susan,” and “Stacy” were also no-gos. On my fifth official try, I found “Sonia” to be her middle name. Once again, this would be a much better story if getting a date with her were explicitly contingent upon the correct guessing of her middle name. This was still not the case. I also realize that any sufficiently technical people reading this post can recognize the simplicity and triviality of the code I wrote. However, the feeling of being some kind of magical tech wizard in her eyes who could turn raw numbers and letters into successful results lent me the confidence necessary to offer to drive her to a restaurant and pay for her dinner.

We got Mexican. It was delicious. My offer of a second date was preemptively quashed. I saw her at another party a month later. It was weird.

Comments