
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
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

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

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

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 5 images

Knowledge Booster
Similar questions
- In Python language, define a function that takes two parameters count and sum as the parameters and returns the average from the function. Also, make a call to the function for some sample test cases.arrow_forwardWrite a recursive function that parses a hex number as a string into a decimal integer. The function header is as follows:def hexToDecimal(hexString):Write a test program that prompts the user to enter a hex string and displays its decimal equivalent.arrow_forwardWrite a function in Python language to take two integer parameters and return whichever value is nearest to the value 10, or return 0 if two integers are equal.arrow_forward
- PYTHON Code your own Python function to solve Ax=b. Add a documentation string section to be used with the Python function help() function. Demonstrate the function is correctly implemented, and explain your testing approach.arrow_forwardWrite a lisp program (please provide photos that it works)arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY

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 Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science

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
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education

Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY