Stable marriage problem: Difference between revisions

→‎{{header|Python}}: Removed debug code.
(New task and Python solution.)
 
(→‎{{header|Python}}: Removed debug code.)
Line 36:
=={{header|Python}}==
<lang python>import random, copy
##from pprint import pprint as pp
from collections import defaultdict
 
##def shuffle(array):
## random.shuffle(array)
## return array[:]
 
guys = 'abe bob col dan ed fred gav hal ian jon'.strip().split()
gals = 'abi bea cath dee eve fay gay hope ivy jan'.strip().split()
 
##guyprefers = dict( (g, shuffle(gals)) for g in guys )
##galprefers = dict( (g, shuffle(guys)) for g in gals )
##pp(guyprefers, width=100)
##pp(galprefers, width=100)
 
guyprefers = {'abe': ['abi', 'eve', 'cath', 'ivy', 'jan', 'dee', 'fay', 'bea', 'hope', 'gay'],
Anonymous user