Skip to content

Instantly share code, notes, and snippets.

@sencagri
Created October 27, 2017 10:50
Show Gist options
  • Save sencagri/c00a24e583541f2b6d79975b4f33d0a0 to your computer and use it in GitHub Desktop.
Save sencagri/c00a24e583541f2b6d79975b4f33d0a0 to your computer and use it in GitHub Desktop.
PR Q1
import numpy as np
p = 0.2
size = 1000
bern = np.random.binominal(1,p, size)
zeros = 0
ones = 0
for item in bern:
if item == 0:
ones += 1
else:
zeros += 1
print("total zero %s" %zeros)
print("total ones %s" %ones)
print("total zero %s" %(ones / (ones + zeros))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment