Write a Python module that gets a block of text from the user and prints some statistics about the text. There is an image attached for function requirements and an image for the output example. Use the string module for strings and the re module for regular expressions to parse the text. Single letters/digits are also considered palindromes

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Write a Python module that gets a block of text from the user and prints some statistics about the text.

There is an image attached for function requirements and an image for the output example.

  • Use the string module for strings and the re module for regular expressions to parse the text.
  • Single letters/digits are also considered palindromes
Function name
get_sentences()
get_words()
get_punctuations()
print_letters()
Function description
main()
Returns the number of sentences in the text.
There are 03 ways to punctuate the end of a
sentence: a period, an exclamation mark, or a
question mark.
Returns the number of words in the text.
Returns the number of punctuations in the text.
Prints the number of occurrences of
case-insensitive letters in the text.
Case-insensitive means that a letter is the same
whether it is uppercase or lowercase.
The function should print the letters in decreasing
order of the number of occurrences. If multiple
letters have the same number of occurrences,
print the letters in alphabetical order. Separate
groups of letters with the same number of
occurrences by a blank line.
print_palindromes() Prints the number of occurrences of
case-insensitive palindrome numbers and
palindrome words and letters in the text. The
function should print the palindromes sorted
alphanumerically with their number of
occurrences. Numbers must be printed first,
words and letters printed next.
Driver function that calls all the functions above.
Function
input(s)
Text
Text
Text
Block of text
Block of text
None
Function output(s)/
return value(s)
Number of sentences
Number of words
Number of
punctuations
Occurences of letters
in the text
Occurences of
palindromes in the
text
Transcribed Image Text:Function name get_sentences() get_words() get_punctuations() print_letters() Function description main() Returns the number of sentences in the text. There are 03 ways to punctuate the end of a sentence: a period, an exclamation mark, or a question mark. Returns the number of words in the text. Returns the number of punctuations in the text. Prints the number of occurrences of case-insensitive letters in the text. Case-insensitive means that a letter is the same whether it is uppercase or lowercase. The function should print the letters in decreasing order of the number of occurrences. If multiple letters have the same number of occurrences, print the letters in alphabetical order. Separate groups of letters with the same number of occurrences by a blank line. print_palindromes() Prints the number of occurrences of case-insensitive palindrome numbers and palindrome words and letters in the text. The function should print the palindromes sorted alphanumerically with their number of occurrences. Numbers must be printed first, words and letters printed next. Driver function that calls all the functions above. Function input(s) Text Text Text Block of text Block of text None Function output(s)/ return value(s) Number of sentences Number of words Number of punctuations Occurences of letters in the text Occurences of palindromes in the text
Enter text: The kayak 404 on my civic has a custom 747 radar. The radar
stats from review 404 are the most reliable. Civic racecar model 2019 has
an iron rotor, but not the Boeing 747. Radar stats 404 page not found on
level 55.
Number of sentences: 4
Number of words: 43
Number of punctuations: 5
Letter statistics:
a found 19 times.
e found 15 times.
r found 15 times.
It found 14 times.
o found 13 times.
i found 8 times.
In found 8 times.
s found 8 times.
c found 7 times.
h found 6 times.
d found 5 times.
1 found 5 times.
Im found 5 times.
v found 4 times.
b found 3 times.
u found 3 times.
of found 2 times.
g found 2 times.
k found 2 times.
y found 2 times.
p found 1 time.
w found 1 time.
Palindrome numbers:
404: 3
55: 1
747: 2
Palindrome words and letters:
a: 1
civic: 2
kayak: 1
level: 1
racecar: 1
radar: 3
rotor: 1
stats: 2
Transcribed Image Text:Enter text: The kayak 404 on my civic has a custom 747 radar. The radar stats from review 404 are the most reliable. Civic racecar model 2019 has an iron rotor, but not the Boeing 747. Radar stats 404 page not found on level 55. Number of sentences: 4 Number of words: 43 Number of punctuations: 5 Letter statistics: a found 19 times. e found 15 times. r found 15 times. It found 14 times. o found 13 times. i found 8 times. In found 8 times. s found 8 times. c found 7 times. h found 6 times. d found 5 times. 1 found 5 times. Im found 5 times. v found 4 times. b found 3 times. u found 3 times. of found 2 times. g found 2 times. k found 2 times. y found 2 times. p found 1 time. w found 1 time. Palindrome numbers: 404: 3 55: 1 747: 2 Palindrome words and letters: a: 1 civic: 2 kayak: 1 level: 1 racecar: 1 radar: 3 rotor: 1 stats: 2
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 5 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY