Skip to content

Instantly share code, notes, and snippets.

@wfaria
Created March 9, 2019 23:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wfaria/24adfa7f28a4a168966a9507fab7448d to your computer and use it in GitHub Desktop.
Save wfaria/24adfa7f28a4a168966a9507fab7448d to your computer and use it in GitHub Desktop.
Election Poll Simulation - Getting a Sample of size 10
def get_sample_from_distribution(n):
"""
Creates an array of size n.
Each value will be 1 if some person would vote on Alice and
0 if he would vote on Bob.
"""
sample_opinions = []
for i in range(n):
sample_opinions.append(get_opinion_from_random_person())
return sample_opinions
example = get_sample_from_distribution(10)
print(example)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment