Skip to content

Instantly share code, notes, and snippets.

@kokumura
Last active May 7, 2017
Embed
What would you like to do?
katan-haibun.py
import random
import sys
C = ['ヒツジ', '麦', 'レンガ', '木', '石']
def katan(n):
import collections
c = collections.defaultdict(lambda: 0)
for i in range(n):
c[random.choice(C)] += 1
return c
for k, v in katan(int(sys.argv[1])).items():
print(f'{k} => {v}')
@kokumura
Copy link
Author

kokumura commented May 5, 2017

$ python katan-haibun.py 10
麦 => 3
レンガ => 2
木 => 4
石 => 1

requires Python >= 3.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment