Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Election Poll Simulation - Asking opinion from a single person.
import numpy as np
import matplotlib.pyplot as plt
import math
def get_opinion_from_random_person():
# Usually this probabiliy is not known. Setting it here for simulation purposes.
probability_of_alice_win = 0.53
return np.random.binomial(
n = 1,
p = probability_of_alice_win)
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.