projects
/
susannes-git
/
mathe
/
stats
/
bernoulli.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3f25538
)
Two off-by-one errors
author
tomás zerolo
<tomas@tuxteam.de>
Sun, 20 Nov 2022 15:30:19 +0000
(16:30 +0100)
committer
tomás zerolo
<tomas@tuxteam.de>
Sun, 20 Nov 2022 15:30:19 +0000
(16:30 +0100)
coinflip.py
patch
|
blob
|
history
diff --git
a/coinflip.py
b/coinflip.py
index 7a5f62db1f60114f02b40081eff7b2a5d170ee6e..7ed659821910892b0a973133eba5ec2057df3151 100755
(executable)
--- a/
coinflip.py
+++ b/
coinflip.py
@@
-4,7
+4,7
@@
import sys
from random import random
def flipcoins (n):
- return [int(2*random()) for i in range(n
-1
)]
+ return [int(2*random()) for i in range(n)]
if len(sys.argv) != 3:
print(f"Usage: {sys.argv[0]} <flips> <repeats>\n")
@@
-13,5
+13,5
@@
if len(sys.argv) != 3:
flips = int(sys.argv[1])
repeats = int(sys.argv[2])
-for i in range(repeats
- 1
):
+for i in range(repeats):
print(flipcoins(flips))