Skip to content

Instantly share code, notes, and snippets.

@pi314
Created June 22, 2019 14:30
Show Gist options
  • Save pi314/ef58dbed6e182abf4bd695ed8d544910 to your computer and use it in GitHub Desktop.
Save pi314/ef58dbed6e182abf4bd695ed8d544910 to your computer and use it in GitHub Desktop.
import random
def main():
results = {}
results['OO'] = 0
results['OX'] = 0
results['XO'] = 0
results['XX'] = 0
for i in range(10000):
A = random.choice(['O', 'X'])
B = random.choice(['O', 'X'])
if A == 'O' and B == 'O': # the question said this combination *didn't* happen
continue
results[A+B] += 1
print(results)
# {'OO': 0, 'OX': 2479, 'XO': 2457, 'XX': 2556}
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment