Created
March 9, 2019 23:09
-
-
Save wfaria/24adfa7f28a4a168966a9507fab7448d to your computer and use it in GitHub Desktop.
Election Poll Simulation - Getting a Sample of size 10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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