Op 08-09-13 04:12, Jason Friedman schreef:
choices = dict()
choices["apple"] = 10
choices["pear"] = 20
choices["banana"] = 15
choices["orange"] = 25
choices["kiwi"] = 30
I want to pick sets of fruit, three in a set, where the chance of
selecting a given fruit is proportional to its weight. In the example
above, pears should appear twice as often as apples and kiwis should
appear twice as often as bananas.
Just a small question. Is a set of three bananas an acceptable outcome?
--
Antoon Pardon
--
https://mail.python.org/mailman/listinfo/python-list