Question: 8.2 (Random Sentences) Write a script that uses random-number generation to com- pose sentences. Use four arrays of strings called article, noun, verb and
8.2 (Random Sentences) Write a script that uses random-number generation to com- pose sentences. Use four arrays of strings called article, noun, verb and preposition. Create a sentence by selecting a word at random from each array in the following order: article, noun, verb, preposition, article and noun. As each word is picked, concate- nate it to the previous words in the sentence. Spaces should separate the words. When the final sentence is output, it should start with a capital letter and end with a period. The script should generate and display 20 sentences.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
