Skip to content

Instantly share code, notes, and snippets.

@avamsi
Last active March 19, 2016 02:07
Show Gist options
  • Select an option

  • Save avamsi/f88463f1aae9790938f4 to your computer and use it in GitHub Desktop.

Select an option

Save avamsi/f88463f1aae9790938f4 to your computer and use it in GitHub Desktop.
import random
objs = [0, 0, 1]
wins = 0
TIMES = 10**4
for _ in xrange(TIMES):
random.shuffle(objs)
wins += random.choice(objs)
print 'Win % with switching:', 100 - 100.0 * wins/TIMES
print 'Win % without switching:', 100.0 * wins/TIMES
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment