import matplotlib.pyplot as plot
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")
flips = int(sys.argv[1])
repeats = int(sys.argv[2])
-vals = [sum(flipcoins(flips)) for i in range(repeats - 1)]
+vals = [sum(flipcoins(flips)) for i in range(repeats)]
plot.hist(vals, bins=flips, align='left')
plot.show()