From: tomás zerolo Date: Sun, 20 Nov 2022 13:38:31 +0000 (+0100) Subject: coinflip flips coins X-Git-Url: http://git.tuxteam.de/gitweb/?a=commitdiff_plain;h=f66d1963798b688b8bc551c05c5db1e53a828f50;p=susannes-git%2Fmathe%2Fstats%2Fbernoulli.git coinflip flips coins --- f66d1963798b688b8bc551c05c5db1e53a828f50 diff --git a/coinflip.py b/coinflip.py new file mode 100755 index 0000000..7a5f62d --- /dev/null +++ b/coinflip.py @@ -0,0 +1,17 @@ +#!/usr/bin/python3 + +import sys +from random import random + +def flipcoins (n): + return [int(2*random()) for i in range(n-1)] + +if len(sys.argv) != 3: + print(f"Usage: {sys.argv[0]} \n") + exit(1) + +flips = int(sys.argv[1]) +repeats = int(sys.argv[2]) + +for i in range(repeats - 1): + print(flipcoins(flips)) diff --git a/notes b/notes new file mode 100644 index 0000000..ef9e7aa --- /dev/null +++ b/notes @@ -0,0 +1,2 @@ +# -*- mode: org -*- +#+title: bernoulli stuff