Question: python programming challenge Turn the example above into a method and create a csv file that contains the empirical distribution over 10,000 trials for integersequence(arg,10)
python programming challenge
Turn the example above into a method and create a csv file that contains the empirical distribution over 10,000 trials for integersequence(arg,10) where arg ranges from two to 20.

In [ 1: trial_num- 10000 num outcomes5 vec length10 empirical_dist-np.zeros (vec_length+1) for trial in range (0, trial_num): # Computes empirical distribution of ones outcome = [ 1 ] *vec-lengthEDIT count ones-outcome.count (1) empirical distrcount ones1 + 1 empirical dist - empirical dist/trial num plt.bar (range (0,11),empirical dist) plt.show) Turn the example above into a method and create a csv file that contains the empirical distribution over 10,000 trials for integersequence (arg, 10) where arg ranges from two to 20 In [ ]: def distribution_sim(num_outcomes_ds-2,vec_length_ds-10): # Returns emmpirical distribution trial num ds10000 empirical dist dsnp.zeros(vec length ds+1) for trial in range(0, trial_num outcome_ds[1]*vec_length EDIT count_ones_dsoutcome_ds.count (1) empirical dist ds [ count ones ds]+ 1 empirical dist dsempirical dist ds/trial num ds return empirical_dist_ds # Create an empty horizontal vector distributionsnp.empty( (0, vec_length+1)) print(distributions.sha pe) In [ 1: trial_num- 10000 num outcomes5 vec length10 empirical_dist-np.zeros (vec_length+1) for trial in range (0, trial_num): # Computes empirical distribution of ones outcome = [ 1 ] *vec-lengthEDIT count ones-outcome.count (1) empirical distrcount ones1 + 1 empirical dist - empirical dist/trial num plt.bar (range (0,11),empirical dist) plt.show) Turn the example above into a method and create a csv file that contains the empirical distribution over 10,000 trials for integersequence (arg, 10) where arg ranges from two to 20 In [ ]: def distribution_sim(num_outcomes_ds-2,vec_length_ds-10): # Returns emmpirical distribution trial num ds10000 empirical dist dsnp.zeros(vec length ds+1) for trial in range(0, trial_num outcome_ds[1]*vec_length EDIT count_ones_dsoutcome_ds.count (1) empirical dist ds [ count ones ds]+ 1 empirical dist dsempirical dist ds/trial num ds return empirical_dist_ds # Create an empty horizontal vector distributionsnp.empty( (0, vec_length+1)) print(distributions.sha pe)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
