Question: Load the necessary module import scipy.stats as stats # Get user-defined number of successes k = int(input()) # Set the number of trials and the
Load the necessary module import scipy.stats as stats # Get user-defined number of successes k = int(input()) # Set the number of trials and the probability of success in each trial n = 10 p = 0.5 # Calculate the probability of k successes given the defined n and p P = stats.binom.pmf(k, n, p) print(f'P: {P:.5f}') # Return the mean of the distribution mean = n * p print(f'mean: {mean:.2f}') # Return the variance of the distribution var = n * p * (1 - p) print(f'variance: {var:.2f}')
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
