Skip to content

Instantly share code, notes, and snippets.

jamesmaa / .py
Created Feb 7, 2018
Raymond Birthday Moving Average
View .py
birthdays = [date(year=1990+x, month=2, day=18) for x in range(5000)]
def avg(birthdays):
return float(len(birthdays)) / len([b for b in birthdays if b.weekday() == 6])
moving_avg = [avg(birthdays[:x]) for x in range(1, 5000)]
jamesmaa / .py
Created Jan 6, 2018
Set Card Game Simulations
View .py
from itertools import product, combinations
from random import shuffle
from collections import OrderedDict, Counter
def is_set(c1, c2, c3):
for i in range(4):
if c1[i] == c2[i] == c3[i]:
elif c1[i] != c2[i] and c2[i] != c3[i] and c3[i] != c1[i]: