Question: Your Tasks Modify the sentence - generator program of Case Study 5 - 1 ( in the file generator.py ) so that it inputs its

Your Tasks Modify the sentence-generator program of Case Study 5-1(in the file generator.py) so that it inputs its vocabulary from a set of text files at startup. The filenames are nouns.txt, verbs.txt, articles.txt, and prepositions.txt.(Hint: Define a single new function, getWords. This function should expect a filename as an argument. The function should open an input file with this name, define a temporary list, read words from the file, and add them to the list. The function should then convert the list to a tuple and return this tuple. Call the function with an actual filename to initialize each of the four variables for the vocabulary.)(LO: 5.1,5.2) Instructions Task 1: Define a single new function, getWords. to initialize each of the four variables for the vocabulary.)(LO: 5.1,5.2) Instructions \times Task 1: Define a single new function, getwords. Test Feedback: Check: 1 Test: Calling getWords with articles.txt return correct tuple. Reason: Expected ('A', 'THE') Error : AssertionError - Assertion failed: Expected ('A', 'THE') Timestamp: 2024-02-2909:10:53.599414 Status: FAILED! Check: 2 Test: Calling getWords with nouns.txt return correct tuple. Reason: Expected ('BOY', 'GIRL', 'BAT', 'BALL') Error : AssertionError - Assertion failed: Expected ('BOY', 'GIRL', 'BAT', 'BALL') Timestamp: 2024-02-2909:10:53.599615 Status: FAILED! Check: 3 Test: Calling getWords with verbs.txt return correct tuple. Reason: Expected ('HIT', 'SAW', 'LIKED') Error : AssertionError - Assertion failed: Expected ('HIT', 'SAW', 'LIKED') Timestamp: 2024-02-2909:10:53.599756 Status: FAILED! Check: 4 Test: Calling getWords with nouns.txt return correct tuple. Reason: Expected ('WITH','BY') Error : AssertionError - Assertion failed: Expected ('WITH','BY') Timestamp: 2024-02-2909:10:53.599864

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!