Question: Write a function called random _ text ( source _ file, num _ words ) that takes in two parameters: source _ file is a
Write a function called randomtextsourcefile, numwords that takes in two parameters:
sourcefile is a string representing the name of a file in the current directory, which well use as a basis for producing our text
numwords is an integer representing the number of words in our output text
You must read in the entire file as a string and call the follows function from Part C to get a dictionary with all the adjacent pairs of words in the file.
The function needs to return a string containing numwords words, separated by spaces. All of the words in the output string need to be from the source file. How each word is chosen depends on which option you choose below:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
