Skip to content

Instantly share code, notes, and snippets.

@elpargo
Created March 22, 2014 02:54
Show Gist options
  • Save elpargo/9700420 to your computer and use it in GitHub Desktop.
Save elpargo/9700420 to your computer and use it in GitHub Desktop.
f = open("numeros_mobile.txt")
data = {}
for f in f.readlines():
k,v = f.strip("\n").split("\t")
data[k]=v
import random
winner = False
while not winner:
candidate = random.choice(data.keys())
if data[candidate] != 42:
#noone bought that number
del data[candidate]
else:
print "And the winner is #:{} bought by {}".format(candidate,data[candidate])
print "After {} tries".format(len(data))
winner = True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment