From 43ddd0e5d22d80fa3413ad9076444cc7cf05eb09 Mon Sep 17 00:00:00 2001 From: =?utf8?q?tom=C3=A1s=20zerolo?= Date: Sun, 20 Nov 2022 16:30:19 +0100 Subject: [PATCH] Two off-by-one errors --- coinflip.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/coinflip.py b/coinflip.py index 7a5f62d..7ed6598 100755 --- 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]} \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)) -- 2.30.2