def __init__(self, prob=.5, size=20): self.n = size self.p = prob Distribution.__init__(self, self.calculate_mean(), self.calculate_stdev())
def __init__(self, prob=.5, size=20): # TODO: store the probability of the distribution in an instance variable p # TODO: store the size of the distribution in an instance variable n # TODO: Now that you know p and n, you can calculate the mean and standard deviation # Use the calculate_mean() and calculate_stdev() methods to calculate the # distribution mean and standard deviation # # Then use the init function from the Distribution class to initialize the # mean and the standard deviation of the distribution # # Hint: You need to define the calculate_mean() and calculate_stdev() methods # farther down in the code starting in line 55. # The init function can get access to these methods via the self # variable. self.p = prob self.n = size mu = self.calculate_mean() sigma = self.calculate_stdev() Distribution.__init__(self, mu, sigma)
def __init__(self, mu=0, sigma=1): Distribution.__init__(self, mu, sigma)
def __init__(self, p=0.5, n=20, mu=0, sigma=1): Distribution.__init__(self, mu, sigma) self.data = [] self.p = p self.n = n """Function to calculate the mean from p and n
def __init__(self, mu=0, sigma=1): print("Inheriting from Generaldistribution class") Distribution.__init__(self, mu, sigma)
def __init__(self, mu=0, sigma=1): #super(Gaussian,self).__init__() Distribution.__init__(self, mu, sigma) #no need to defaut again
def __init__(self, prob): self.p = prob Distribution.__init__(self, self.calculate_mean(), self.calculate_stdev())
def __init__(self, prob = 0.5, size = 20): Distribution.__init__(self, self.calculate_mean(), self.calculate_stdev) self.p = prob self.n = size