And the (Kindle or iPod) Goes To…



As promised, I’m going to pick one person at random of the people who successfully completed the survey and give them a nifty new gadget to enjoy. Since I’m a code monkey at heart, I wanted to choose the winner my way — by writing a simple little program to do it! Now, I’ll walk you through setup and the “drawing” and we can find out who wins together like some sort of weird geographically disparate family!

(This is probably going to bore the hell out of most of you, but just indulge me this once).

First, I exported a list of all of the people who successfully completed the final requirement (registering for the notification list) as a CSV file which I saved as ~/Development/Scripts/btng.csv on my iMac. The file is organized with one person per line.

Next, I wrote a short little Python program to read a file into a list of lines and select one at random.

As a test, I also created a file called test.txt:

Then, I ran the Python script against the test file to make sure it was working:

Brett-Kellys-iMac:Scripts inkedmn$ python SurveyDrawingWinner.py
I'm line 10

Brett-Kellys-iMac:Scripts inkedmn$ python SurveyDrawingWinner.py
I'm line 7

Brett-Kellys-iMac:Scripts inkedmn$ python SurveyDrawingWinner.py
I'm line 9

Brett-Kellys-iMac:Scripts inkedmn$ python SurveyDrawingWinner.py
I'm line 6

Now, we change the file to use our real list of entrants and…

Brett-Kellys-iMac:Scripts inkedmn$ python SurveyDrawingWinner.py
"steve pelletier"

Congratulations, Mr. Pelletier! I’ll be notifying you via email right after this post goes up, but you’re the big freaking winner :)

Thanks so much to everybody who gave honest feedback on the survey – you’ve been a huge help in getting me to solidify what I’m doing here. Hope you guys stick around and, if I may pander a bit here, tell a friend if you think this site doesn’t suck.

Cheers!

Photo by Dave_B_

Trackbacks

  1. snack or a meal after you workout,…

    depending of course on what time it is when you get home. after a workout, your body needs proper nutrition to repair itself. if you find yourself wondering what the best snack options are after a workout, try these out:pita …

  2. good site says:

    a good way, wherein you get paid…

    to read bulk emails of your clients. in order to do the same, you will first need to open an account with a trustworthy website, after which you will start to get emails for opening. and the amount you can get…

  3. should do the blogging?the question of who…

    should write your company’s blog posts hinges to a great extent on the size and nature of your company. because blogging is like brand building in that it doesn’t directly generate sales, it should be considered a relatively low payoff activity….

  4. deadly streets of riverside county in california,…

    that making it alive on the other side is either impossible or improbable.blog writing as moral and social responsibilityi’ve read and seen handful of internet writers who obviously write only for egocentric reasons. few months back, i’ve read an art…

  5. click here says:

    the nature of the blog, business owners…

    may even choose to include their own personal opinions about different subjects or stray off-topic from time to time in order to seem more personable. no one understands the process of writing a successful blog better than blog post writers for…

  6. most online users have a very short…

    attention span. so, if you want to write a blog post that is of high quality, i suggest that you keep it short. provide all the information that your target audience wants to learn in as little words as possible. a…