Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In Python, can you please help me solve this problem? ----- Paper Generator With

ID: 643538 • Letter: I

Question

In Python, can you please help me solve this problem?

-----

Paper Generator

With the end of the semester in (distant) sight, you're probably taking classes that require term papers. Wouldn't it be nice if a
computer could write those papers for you? We won't quite do that here (it's a really hard problem!), but let's make a first step in that
direction.

First, write functions called random_noun(), random_verb(), and random_adjective() that return a randomly-chosen noun, verb, or
adjective, respectively. (Include at least 5 nouns, 5 adjectives, and 5 verbs that the functions can choose from.) Then, write a function
called random_sentence() that returns a string of this form:

The (random_adjective) (random_noun) (random_verb) the (random_adjective) (random_noun).

with random words filled in using the corresponding functions you wrote above.

Finally, write a function called random_essay() that takes a single argument specifying the number of random sentences that the essay
should contain, and returns a string with that number of sentences created by calling random_sentence() repeatedly. Your main program
should ask the user for the number of sentences and print out the result. Here's an example:

>>>
How many sentences would you like in your essay? 3
Here's your automatically-generated essay:
The ugly sandwich sang the uneven dog.
The green flower ate the soggy tree.
The brilliant cat walked the brilliant sandwich.

Your functions should return strings instead of printing them. In other words, the only print statements in your program should be in the main body, not in the functions themselves.

Explanation / Answer

import random

s_nouns = ["A dude", "My mom", "The king", "Some guy", "A cat with rabies", "A sloth", "Your homie", "This cool guy my gardener met yesterday", "Superman"]
p_nouns = ["These dudes", "Both of my moms", "All the kings of the world", "Some guys", "All of a cattery's cats", "The multitude of sloths living under your bed", "Your homies", "Like, these, like, all these people", "Supermen"]
s_verbs = ["eats", "kicks", "gives", "treats", "meets with", "creates", "hacks", "configures", "spies on", "retards", "meows on", "flees from", "tries to automate", "explodes"]
p_verbs = ["eat", "kick", "give", "treat", "meet with", "create", "hack", "configure", "spy on", "retard", "meow on", "flee from", "try to automate", "explode"]
infinitives = ["to make a pie.", "for no apparent reason.", "because the sky is green.", "for a disease.", "to be able to make toast explode.", "to know more about archeology."]

def sing_sen_maker():
'''Makes a random senctence from the different parts of speech. Uses a SINGULAR subject'''
if input("Would you like to add a new word?").lower() == "yes":
new_word = input("Please enter a singular noun.")
s_nouns.append(new_word)
else:
   print random.choice(s_nouns), random.choice(s_verbs), random.choice(s_nouns).lower() or random.choice(p_nouns).lower(), random.choice(infinitives)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote