Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- def comparator(x,y):
- counter = 1
- while set(x) != set(y):
- y = random.sample(range(1,46),4)
- if set(x) == set(y):
- print x,y
- return counter
- else:
- counter +=1
- #call the function 5 times
- for i in range(1,6):
- selection = random.sample(range(1,46),4)
- draw = []
- output = comparator(selection,draw)
- print "Iteration %d = %d attempts" %(i,output)
Add Comment
Please, Sign In to add comment