At Westonci.ca, we connect you with the best answers from a community of experienced and knowledgeable individuals. Connect with a community of professionals ready to help you find accurate solutions to your questions quickly and efficiently. Get immediate and reliable solutions to your questions from a community of experienced professionals on our platform.

100 POINTS FOR ANYONE WHO CAN DO THIS!
Make the following modifications to the original sentence-generator program:

The prepositional phrase is optional. (It can appear with a certain probability.)
A conjunction and a second independent clause are optional: "The boy took a drink and the girl played baseball".
An adjective is optional, it may or may not be added to the sentence to describe a noun: "The girl kicked the red ball with a sore foot".
"Optional" is implying that the program should include these elements in a semi-random frequency.

You should add new variables for the sets of adjectives and conjunctions.

100 POINTS FOR ANYONE WHO CAN DO THIS Make The Following Modifications To The Original Sentencegenerator Program The Prepositional Phrase Is Optional It Can App class=

Sagot :

Let's check what can be modified

Before calling def we need adjective and conjunctions stored inside variables

Store them(You may change according to your choice)

[tex]\tt adjectives=("foolish","bad","long","hard")[/tex]

[tex]\tt conjunctions=("and","but","for","after")[/tex]

We have to make optional ,easy way ask the user to do instead of yourself .

[tex]\tt con=input("Enter\: yes\: if \:you \:want \:to \:use \:conjunctions:")[/tex]

[tex]\tt adj=input("Enter\:yes\:if\:you\:want\:to\:use\: adjectives:")[/tex]

If they click then we can proceed else no problem let the program run

[tex]\tt def\: conjunctionPhrase():[/tex]

[tex]\quad\tt if\: con=="yes":[/tex]

[tex]\quad\quad\tt return\:random.choice(conjunctions)+"\:"+nounPhrase()[/tex]

[tex]\quad\tt else:[/tex]

[tex]\quad\quad\tt continue[/tex]

  • You may use pass also

[tex]\tt def\: adjectivePhrase():[/tex]

[tex]\quad\tt if\:adj=="yes":[/tex]

[tex]\quad\quad\tt return\:random.choice(adjectives)+"\:"+nounPhrase()[/tex]

[tex]\quad\tt else:[/tex]

[tex]\quad\quad\tt continue[/tex]

Thank you for visiting our platform. We hope you found the answers you were looking for. Come back anytime you need more information. We hope you found what you were looking for. Feel free to revisit us for more answers and updated information. Thank you for trusting Westonci.ca. Don't forget to revisit us for more accurate and insightful answers.