Question: Complete a simulation with 10,000 trials, by writing a for loop to pick two words uniformly at random (with replacement) from Pride and Prejudice and
Complete a simulation with 10,000 trials, by writing a for loop to pick two words uniformly at random (with replacement) from Pride and Prejudice and determine if the words have different lengths. When the simulation is completed, num_different should be equal to the number of times that the two words selected in the simulations were different in length.
Hint 1: What function did we use in section 1 to sample at random with replacement from an array?
Hint 2: Remember that != checks for non-equality between two items.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
