Created
March 22, 2014 02:54
-
-
Save elpargo/9700420 to your computer and use it in GitHub Desktop.
This file contains 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
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