Skip to content

Instantly share code, notes, and snippets.

@mgius
Last active December 11, 2015 06:18
Show Gist options
  • Save mgius/4558097 to your computer and use it in GitHub Desktop.
Save mgius/4558097 to your computer and use it in GitHub Desktop.
import random
trials = 10000
win_count = 0
bag = ['RG', 'RP', 'GP']
for _ in xrange(trials):
if 'G' in random.choice(bag):
win_count += 1
print "I won %d out of %d times" % (win_count, trials)
$ python calc_wins.py
I won 6701 out of 10000 times
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment