Created
February 12, 2016 16:51
-
-
Save danared/e8192e18106ec43cfc64 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def load_data(collection, n=100): | |
#let's skip some elements | |
skiplist = [10, 12, 231 , 2 , 4] | |
for i,d in load_data_file(n): | |
d['i'] = i | |
if i in skiplist: | |
continue | |
collection.insert( d ) | |
load_data(collection, 100) | |
distinct = collection.distinct('i') | |
ivalue = random.sample(distinct, 1) | |
winner = collection.find_one({ 'i': ivalue }) | |
print "AND THE WINNER IS ..... " + winner['name'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment