Write a Python program that performs two functions on a given string: 1. Counts and outputs...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a Python program that performs two functions on a given string: 1. Counts and outputs the number of time the word "the" occurs in the string; 2. Finds the longest word in the string and outputs it and its length. For instance, the string could be string1 = "China one of the fastest-growing economies in the world. China is looking for more investments around the world. Also, the whole world is looking at China as a great economic power. Most of the Chinese can foresee the heights that China is capable of reaching." Write a Python program that performs two functions on a given string: 1. Counts and outputs the number of time the word "the" occurs in the string; 2. Finds the longest word in the string and outputs it and its length. For instance, the string could be string1 = "China one of the fastest-growing economies in the world. China is looking for more investments around the world. Also, the whole world is looking at China as a great economic power. Most of the Chinese can foresee the heights that China is capable of reaching."
Expert Answer:
Answer rating: 100% (QA)
Heres a Python program that performs the specified functions on the given string def analyzestringin... View the full answer
Related Book For
Computer Architecture Fundamentals And Principles Of Computer Design
ISBN: 9781032097336
2nd Edition
Authors: Joseph D. Dumas II
Posted Date:
Students also viewed these programming questions
-
You are required to write a Python program that will manage character (heroes and villain) information. Character (hero and villain) information will be stored in a text file that will be read in...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Question 4 The following is the baseline case that we have for Albion Computers in the class, where the exchange rate will remain at $/=1.60: Sales (50,000 units at 1,000/unit) Variable costs (50,000...
-
The following items appear on the balance sheet of Figgins Company at the end of 2018 and 2019: _____________________________________ 2019 _____________ 2018 Current assets...
-
Borges Machine Shop, Inc., has a 1- year contract for the production of 200,000 gear housings for a new off- road vehicle. Owner Luis Borges hopes the contract will be extended and the volume...
-
Gender in the Rock and Roll Hall of Fame From its founding through 2015, the Rock and Roll Hall of Fame has inducted 303 groups or individuals. Forty-seven of the inductees have been female or have...
-
Assume that all assumptions of the single-index model hold, except that the covariance between residuals is a constant K instead of zero. Derive the covariance between the two securities and the...
-
a)Name and explain the major Components of a production system E D (6 marks) A 1 B 3 4 4 C Figure 2: Transversing a graph of a travelling salesman b) Use the nearest neighbour heuristic to find the...
-
1. Which aspect of the French revolution most disturbed commentators? 2. How would you align each of these writers on a spectrum running from extreme right to extreme left in politics? 3. How would...
-
Analyze each scenario, and explain the type of mistake that has occurred. Is it a legal mistake? Scenario1: Ling purchases a pair of shoes from SportsCo for $200.Ling later sees the same shoes at...
-
RFC Corp. has announced a $1.32 dividend. If RFCs price last price cum-dividend is $13.21, what should its first ex-dividend price be (assuming perfect capital markets)?
-
Do you agree that most employers probably want to obey the Americans with Disabilities Act but dont know exactly what they are required to do under the law? Do you think that most employers would...
-
ABC Corporation announced that it will pay a dividend to all shareholders of record as of Monday, April 2, 2012. It takes three business days of a purchase for the new owners of a share of stock to...
-
Candy making is a fun business, and so it is no surprise that it is fun to work at the Jelly Belly Candy Company of Fairfield, California. Although this company has cheesecake, buttered popcorn,...
-
Rajesh is considering two investments. The expected returns are 8% for investment A and 15% for investment B. The standard deviations are 6% and 10% for investments A and B, respectively. Which...
-
In Year 1, Victoria Textiles Limited decided that its Asian operations had expanded such that an Asian office should be established. The office would be involved in selling Victoria's current product...
-
What types of questions can be answered by analyzing financial statements?
-
If a manufacturers brochure states that a given system can perform I/O operations at 1500 MB/s, what questions would you like to ask the manufacturers representative regarding this claim?
-
Repeat question 20 using the vertical control word depicted in Figure 3.42. Question 20 Given the horizontal control word depicted in Figure 3.41 for our simple example machine, develop the micro...
-
What was the main architectural difference between the two early computers ENIAC and EDVAC?
-
What is the change in velocity of \((a)\) cart 1 (b) cart 2 in Figure 4.6? (c) What do you notice about your two answers? Figure 4.6 Velocity-versus-time graph for two identical carts before and...
-
(a) Are the accelerations of the motions shown in Figure 4.1 constant? (b) For which surface is the acceleration largest in magnitude? Figure 4.1 Velocity-versus-time graph for a wooden block sliding...
-
The \(x\) component of the final velocity of the standard cart in Figure 4.8 is positive. Can you make it negative by adjusting this cart's initial speed while still keeping the half cart initially...
Study smarter with the SolutionInn App