1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Alinara [238K]
3 years ago
7

uestion 2. Using a simulation with 10,000 trials, assign num_different to the number of times, in 10,000 trials, that two words

picked uniformly at random (with replacement) from Pride and Prejudice have different lengths. 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.
History
1 answer:
Olegator [25]3 years ago
7 0

Answer:

This simulation will be done using Python programming language

# Program is written in Python

# Comments are used for explanatory purpose

# Program starts here

stringtocheck = open('PrideAndPrejudice.txt', encoding='utf-8').

read()

#Split words

splitwords = np.array(string.split())

In []:

# Initialise trial simulation to 10000 in test variable

test = 10000

# Initialise diff to 0

diff = 0

# iterate for possible words in PrideAndPrejudice

for i in np.arange(test):

# search for 2 words

words = np.random.choice(splitwords, 2)

#implement the condition in hint above

iflen(words.item(0)) != len(words.item(1)) != len(words.item(2)) != len(words.item(0)):

#calcuate result

diff = diff + 1

num_different = diff/test

You might be interested in
What was a reason for the expansion of machine politics in the late nineteenth century?
tatuchka [14]

Answer:

The rapid influx of immigrants made it difficult for local governments to provide basic services. Federal restrictions prevented voters from influencing government decisions at the local level

8 0
3 years ago
Whats the Exhcange term to identify the forced transfer of slaves to the Americas ,​
zhenek [66]

Answer:

The African slave trade

Hope this helps!

4 0
3 years ago
Explain the mandate of heaven zhou
aleksklad [387]
The mandate of heaven is an honor that only good rulers are allowed to rule with other wise the others were just roked
6 0
3 years ago
Which phrase best defines the liquidity of money
Fiesta28 [93]

Answer:

how available money is to spend

3 0
3 years ago
Read 2 more answers
What was the main crop during the early Oklahoma Territory years due to the opening of lands later in the year?
Nat2105 [25]

The answer is: B) Wheat

During the early years of the Oklahoma territory, settlers found wheat to be the most profitable crop, since wheat did not require as much moisture as other crops and the Oklahoma soil and climate had perfect conditions to grow this type of crop instead of others like corn and turnips.


7 0
3 years ago
Read 2 more answers
Other questions:
  • Who set up trading stations along the indian coast during the 1700s?
    13·1 answer
  • Which event marked the end of the anglo saxon period of british literure?
    9·1 answer
  • Who did Cavour make alliances with for land? a. France c. Sicilly b. Austria-Hungary d. Sardinia
    12·1 answer
  • Who in the Clinton administration addressed global warming and climate change?
    15·1 answer
  • Which BEST describes why Chinese workers were used to construct the Transcontinental Railroad?
    9·1 answer
  • After Soviet postwar actions made it plain that it was trying to expand communist influence, President Harry Truman and his advi
    9·1 answer
  • What feature of a confederal system did the confederate states of American most want
    9·1 answer
  • 1. The new federal government in America took actions that would set an example for the future. In George Washington’s words, th
    5·1 answer
  • The extensive use of __________ during the 1920s allowed consumers to “buy now, pay later.”
    14·2 answers
  • Which of the following cities did NOT serve as a capital city of the Muslim Empire?
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!