Need to Generate a binomial distribution, tested 10 times, given the number of trials(n) and probability(p) of each trial.
The output should contain a numpy array with 10 numbers representing the required binomial distribution.
Sample Input: 0 10 0.5
Expected Output:
[5 6 5 5 5 6 5 7 8 5]
My Code:
import numpy as np
import pandas as pd
pd.set_option('display.max_columns', 500)
np.random.seed(0)
seed=int(input())
n=int(input())
p=float(input())
i = 1
while i <= n:
x = np.random.binomial(n, p)
s=np.array(x)
print(s)
i += 1
Code Output:
5 6 5 5 5 6 5 7 8 5
Output is not coming out as desired what am i doing wrong here?