Question
If your program fulfills the requirements for this assignment as described in the previous prove milestone and the Assignment section above, your program will earn
If your program fulfills the requirements for this assignment as described in the previous prove milestone and the Assignment section above, your program will earn 93% of the possible points. In order to earn the remaining 7% of points, you will need to add one or more features to your program so that it exceeds the requirements. Here are a few suggestions for additional features that you could add to your program if you wish. Within your main function add another call to get_prepositional_phrase so that each sentence includes two prepositional phrases like this: One girl across one cat talked for the car. A bird near the rabbit drinks off one child. The child under the cat will run on the car. Some dogs without a cat drank above many rabbits. Some children from a bird laugh at many dogs. Some rabbits behind one man will talk about some cats. Write a function named get_adjective and call it in your main function to add an adjective to the sentences produced by your program. Does it make sense to call get_adjective in your get_prepositional_phrase function? In test_sentences.py write a function named test_get_adjective that tests the get_adjective function. Write a function named get_adverb and call it in your main function to add an adverb to the sentences produced by your program. In test_sentences.py write a function named test_get_adverb that tests the get_adverb function.
import random
def get_determiner():
determiners = ["One", "A", "The", "Some"]
return random.choice(determiners)
def get_noun():
nouns = ["girl", "boy", "bird", "car", "child", "dog", "rabbit", "cat"]
return random.choice(nouns)
def get_verb():
verbs = ["talked", "drank", "ran", "laughed", "will talk"]
return random.choice(verbs)
def get_preposition():
prepositions = ["for", "off", "on", "above", "at", "about"]
return random.choice(prepositions)
def get_prepositional_phrase():
preposition = get_preposition()
determiner = get_determiner()
noun = get_noun()
return f"{preposition} {determiner} {noun}"
def main():
determiner = get_determiner()
noun = get_noun()
verb = get_verb()
prepositional_phrase = get_prepositional_phrase()
sentence = f"{determiner} {noun} {verb} {prepositional_phrase}."
print(sentence)
if __name__ == "__main__":
main()
import unittest
import sentences
class TestSentences(unittest.TestCase):
def test_get_determiner(self):
determiner = sentences.get_determiner()
self.assertIn(determiner, ["One", "A", "The", "Some"])
def test_get_noun(self):
noun = sentences.get_noun()
self.assertIn(noun, ["girl", "boy", "bird", "car", "child", "dog", "rabbit", "cat"])
def test_get_verb(self):
verb = sentences.get_verb()
self.assertIn(verb, ["talked", "drank", "ran", "laughed", "will talk"])
def test_get_preposition(self):
preposition = sentences.get_preposition()
self.assertIn(preposition, ["for", "off", "on", "above", "at", "about"])
def test_get_prepositional_phrase(self):
prepositional_phrase = sentences.get_prepositional_phrase()
self.assertIsInstance(prepositional_phrase, str)
if __name__ == "__main__":
unittest.main()
Please assist with exceeding requirements
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started