Skip to content

Instantly share code, notes, and snippets.



Last active Jan 17, 2018
What would you like to do?
digital die, just paste in into the python/ipython shell
from random import randint
from functools import partial
def d(m, n=1):
s = 0
for _ in range(n):
r = randint(1, m)
s += r
if n > 1:
print('sum:', s)
d6 = partial(d, 6, 1)
d20 = partial(d, 20, 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment