Write a Python function (give it any name you choose) to analyze a text string given to it. The function will receive one single string as argument It will return two tuples of two elements each: One tuple contains the word with the maximum occurrence in the input text and the number of its occurrence. The other tuple contains the longest word with in the input text and the number of characters in it. The function should be called like function1(text), where text is a string variable. Use the paragraph below to test your code:

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter5: Repetition Statements
Section5.5: A Closer Look: Loop Programming Techniques
Problem 12E: (Program) Write a program that tests the effectiveness of the rand() library function. Start by...
icon
Related questions
Question

Write a Python function (give it any name you choose) to analyze a text string given to it.

  1. The function will receive one single string as argument
  2. It will return two tuples of two elements each:
    1. One tuple contains the word with the maximum occurrence in the input text and the number of its occurrence.
    2. The other tuple contains the longest word with in the input text and the number of characters in it.
  3. The function should be called like function1(text), where text is a string variable.
  4. Use the paragraph below to test your code:

 

text = ‘’’During a wet autumnal walk, I was explaining to my girlfriend about my recent presentations. I've been doing my 'Getting Started with Python' talk at Aruba Airheads meet-ups. I recorded an early version of it, see below. One point I mentioned is that the reaction is always mixed. When I ask who is learning Python, about 5% of each audience put their hands up. Regularly people object to the idea of network engineers learning Python. The arguments are usually along the lines of 'network engineers already have enough to learn'. The conversation continued as we walked through sodden leaves and we discussed why, if the other speakers were doing talks that the crowds want to hear, like product updates, I'm burdened with a subject the audience are less enthusiastic about. The assumption being that I was assigned this topic. My response: "Oh no, I choose to do this." The next question was, of course, "Why?"

My Why:

There's something of the two-edged sword in the word 'why'. It can be used to undermine, casting doubt about the veracity of an argument, cutting through the rhetoric and leaving those with ill-reasoned ideas to flounder and stutter a response. But it can also galvanize, provide the opportunity to refine and reinforce one's thoughts, to thrust home one's argument.

Here's my why. Why I think learning Python is a worthwhile exercise as the first step on the road to automating networks, and this conviction stems from personal experience.’’’

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Arrays
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr