Question: Implement a program that computes the approximate grade level needed to comprehend some text. Here's a sample run of the program: $ python3 readability.py Text:

 Implement a program that computes the approximate grade level needed to

Implement a program that computes the approximate grade level needed to comprehend some text. Here's a sample run of the program: $ python3 readability.py Text: Congratulations! Today is your day. You're off to great places! You're off and away! Grade 3 Specification Write in a file named readability.py, a program that first asks the user to type in some text, and then outputs the grade level for the text, according to the Coleman-Liau formula. Coleman-Liau index is computed as 0.0588 *L -0.296 * S - 15.8, where is the average number of letters per 100 words in the text, and is the average number of sentences per 100 words in the text. Your program should count the number of letters, words, and sentences in the text. You may assume that a letter is any lowercase characters from a to z any uppercase characters from A to Z or any digit from 0 to 9. Any other character (e.g. - dash), (apostrophe)) is not counted as letter. Any sequence of characters separated by spaces are counted as a word. Assume that input will not put 2 or more spaces between words. Any occurrence of a period, exclamation point, or question mark indicates the end of a sentence. For the case of abbreviations, assume the user inputs them without dot (e.g. NCR and not N.C.R.). . Your program should print as output "Grade X" where X is the grade level computed by the Coleman-Liau formula, rounded to the nearest integer. If the resulting index number is 16 or higher (equivalent to or greater than a senior undergraduate reading level), your program should output "Grade 16+" instead of giving the exact index number. If the index number is less than 1, your program should output "Before Grade 1". Testing You can use the following test cases to check the correctness of your program: 1. One fish. Two fish. Red fish. Blue fish. Before Grade 1 2. Would you like them here or there? I would not like them here or there. I would not like them anywhere. Grade 2 3. Congratulations! Today is your day. You're off to Great Places! You're off and away! Grade 3 4. Harry Potter was a highly unusual boy in many ways. For one thing, he hated the summer holidays more than any other time of year. For another, he really wanted to do his homework, but was forced to do it in secret, in the dead of the night. And he also happened to be a wizard. Grade 5 5. In my younger and more vulnerable years my father gave me some advice that I've been turning over in my mind ever since. Grade 7 6. Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do: once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it, "and what is the use of a book," thought Alice "without pictures or conversation?" Grade 8 7. When he was nearly thirteen, my brother Jem got his arm badly broken at the elbow. When it healed, and Jem's fears of never being able to play football were assuaged, he was seldom self-conscious about his injury. His left arm was somewhat shorter than his right, when he stood or walked, the back of his hand was at right angles to his body, his thumb parallel to his thigh. Grade 8 8. There are more things in Heaven and Earth, Horatio, than are dreamt of in your philosophy. Grade 9 9. It was a bright cold day in April, and the clocks were striking thirteen. Winston Smith, his chin nuzzled into his breast in an effort to escape the vile wind, slipped quickly through the glass doors of Victory Mansions, though not quickly enough to prevent a swirl of gritty dust from entering along with him. Grade 10 10. A large class of computational problems involve the determination of properties of graphs, digraphs, integers, arrays of integers, finite families of finite sets, boolean formulas and elements of other countable domains. Grade 16+

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!