This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)] | |
plt.plot(moving_avg) | |
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]: | |
continue | |
elif c1[i] != c2[i] and c2[i] != c3[i] and c3[i] != c1[i]: |