Skip to content

Instantly share code, notes, and snippets.

@eustin
Created March 31, 2020 08:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eustin/44f436fe679fad020e5a66cab29096ee to your computer and use it in GitHub Desktop.
Save eustin/44f436fe679fad020e5a66cab29096ee to your computer and use it in GitHub Desktop.
def calc_prop_matching_pairs(trial_results):
num_matching_pairs = sum([1 for x in results.values() if x[0] == x[1]])
num_total_pairs = len(results.values())
# of all the pairs we have drawn, what proportion were matching pairs of socks?
prop_matching_pairs = num_matching_pairs / num_total_pairs
print(f"\nprop valid pairs over {NUM_TRIALS:,} trials: {prop_matching_pairs:.2f}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment