Open study

is now brainly

With Brainly you can:

  • Get homework help from millions of students and moderators
  • Learn how to solve problems with step-by-step explanations
  • Share your knowledge and earn points by helping other students
  • Learn anywhere, anytime with the Brainly app!

A community for students.

Pls help def generateForm(story, listOfAdjs, listOfNouns, listOfVerbs): """ story: a string containing sentences listOfAdjs: a list of valid adjectives listOfNouns: a list of valid nouns listOfVerbs: a list of valid verbs For each word in story that is in one of the lists, * replace it with the string '[ADJ]' if the word is in listOfAdjs * replace it with the string '[VERB]' if the word is in listOfVerbs * replace it with the string '[NOUN]' if the word is in listOfNouns returns: string, A Mad-Libs form of the story. """

Computer Science
See more answers at brainly.com
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions

Its python
THE CODE def generateForm(story, listOfAdjs, listOfNouns, listOfVerbs): """ story: a string containing sentences listOfAdjs: a list of valid adjectives listOfNouns: a list of valid nouns listOfVerbs: a list of valid verbs For each word in story that is in one of the lists, * replace it with the string '[ADJ]' if the word is in listOfAdjs * replace it with the string '[VERB]' if the word is in listOfVerbs * replace it with the string '[NOUN]' if the word is in listOfNouns returns: string, A Mad-Libs form of the story. """ s = story.split() #splits on whitespace only for i in range(len(s)): if s[i] in listOfAdjs: s[i] = '[ADJ]' elif s[i] in listOfNouns: s[i] = '[NOUN]' elif s[i] in listOfVerbs: s[i] = '[VERB]' return ' '.join(s) THE TEST listOfAdjs = ['adj1', 'adj2', 'adj3'] listOfNouns = ['noun1', 'noun2', 'noun3'] listOfVerbs = ['verb1', 'verb2', 'verb3'] story = "Once upon a noun1 verb2 adj3 I had a noun2 verb3 adj1 and then noun3" mad = generateForm(story, listOfAdjs, listOfNouns, listOfVerbs) print(mad) THE OUTPUT Once upon a [NOUN] [VERB] [ADJ] I had a [NOUN] [VERB] [ADJ] and then [NOUN]
Thank you @msmithhnova

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

Not the answer you are looking for?

Search for more explanations.

Ask your own question