Skip to content

Instantly share code, notes, and snippets.

@ryonsherman
Created May 10, 2013 17:17
Show Gist options
  • Save ryonsherman/5555881 to your computer and use it in GitHub Desktop.
Save ryonsherman/5555881 to your computer and use it in GitHub Desktop.
One-liner to scrape winning lotto numbers and display most common selection at each position.
import urllib, csv, collections; print ', '.join([collections.Counter(values).most_common(1)[0][0] for values in map(lambda i: [value[0] for value in map(lambda values: [value for index, value in enumerate(values) if index is i], map(lambda row: row[4:10], csv.reader(urllib.urlopen("http://txlottery.org/export/sites/lottery/Games/Lotto_Texas/Winning_Numbers/lottotexas.csv"))))], range(6))])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment