i need help writing a python program: write a program that generates syllabic poetry based on a provided list of words which will be provided to you as an actual Python list of lists in the code to...

i need help writing a python program: write a program that generates syllabic poetry based on a provided list of words which will be provided to you as an actual Python list of lists in the code to download. Your program will generate one of the following based on input from the user: haiku tanka a 5 line syllabic poem with a random number of syllables per line a poem whose lines and syllables per line are supplied by the user Your program will ensure that the poetry generated adheres to the number of syllables required by the poem specified (for example, in a haiku, there would be 17 syllables in 3 lines: 5, 7 and 5. However, content will not be taken into consideration. The words provided will be in a format of a list of lists. The outer list will contain seven sub lists of words. Each inner list represents a collection of words with a specific number of syllables. The number of syllables is based on the position of the inner list. The 1st list (at index 0) will have words that have 1 syllable, the 2nd list (and index 1) will have words that have 2 syllables, etc. Assuming that the variable that contains this list of lists is called available_words, to retrieve a list of 2 syllables words, use available_words[1]. To retrieve the word stunner, use available_words[1][0] Feel free to modify this list of lists to suit the kind of content you'd like your poetry generator to create! To write this program: Write the following functions to help with your program generate_word generate_line generate_lines you can write more functions if you want! write an interactive program that asks the user to specify what kind of syllabic poetry to create generate_word(syllables_in_word) Parameters: syllables_in_word - the number of syllables in the word to be generated Return Value: a string - a randomly chosen word composed of the number of syllables specified by syllables_in_word… return None if the number of syllables given is not between 1 and 7 inclusive Description: generate_word is a function that is partially implemented. It contains a local variable that holds a list of lists. Each inner list is a list of strings. The position of the inner list in the containing list determines the number of syllables in each word that it has. generate_line(syllables_in_line) Parameters: syllables_in_line - the total number of syllables in the line of poetry to generate Return Value: a string that represents a series of words whose total number of syllables is equal to syllables_in_line Description: generate_line will create a string that contains a series of words whose total number of syllables is equal to the integer passed in, syllables_in_line. Each word in the series is randomly generated, and the number of syllables of each word is random as well, as long as it fits within the total number of syllables. For example, if number 5 is passed in, this function will generate a string as a sequence of words with the total number of syllables equal to 5. This means that the combination of words may vary. generate_lines(all_lines) Parameters: all_lines - a list of numbers representing the number of syllables in each line; a 5 element list would mean that there are 5 lines in the poem… and each element in that list would represent the number of syllables for that specific line Return Value: a new list that contains a line of words per element, with each line adhering to the number of syllables specified by the list, all_lines, passed in Description: generate_lines will create a list of lines of poetry based on the list of syllables per line passed in. The poem will be generated by choosing the words randomly, but still adhering the number of syllables specified per line. For example, if the list passed in is [5, 7, 5], then a poem with 3 lines, with the first line having 5 syllables, the 2nd line having 7 syllables and the last line, having 5 syllables, would be created. The poem that is generated will be a list of lines. There should be the same number of lines as the number of elements in the list passed in. Using all of the functions that you defined above, create a program that asks the user what kind of poem they would like to generate: I would like to write some poetry for you. Would you like a... * (h)aiku * (t)anka * (r)andom 5 line poem, or do you want to * (s)pecify lines and syllables for each line? Once the user chooses the kind of poem to generate, the program will print out: An abbreviated version of the number of syllables per line, separated by dashes for example 5-7-5 is a three line poem with 5 syllables, 7, and finally 5 again on the last line the output should look like Here is your poem (5-7-5): The poem itself The poem that the program generates will be based on the input from the user: If the user types in h or t, generate a haiku and a tanka poem respectively. A Haiku has a 5-7-5 pattern of syllables per line (5 syllables for the first line, 7 for the second, 5 again for the last). Tanka has 5-7-5-7-7 pattern. If the user chooses r, then generate a 5 line poem with a random number of syllables per line (though, cap the syllables per line to a reasonable amount) Finally, if the user chooses s, then they will be allowed to specify the number of lines and syllables for each line by asking more questions: ask for the number of syllables for the line, and include the line number in the question then… print out the current number of lines and ask if they'd like to continue If the answer is y, then go back to 1 to ask for the number of syllables in the next line If the user does not type valid option, print out ERROR and your favorite poem about making a mistake
Jan 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here