Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.