Problem 44852. Mean number of letters per word (Easy)
Given a character array, s, representing a sentence, return a, the arithmetic mean of the number of letters per word in the given sentence. Round your answer to three decimal digits.
You may make the following assumptions:
1. All characters in the array are either letters or spaces.
2. There are no redundant spaces.
3. Except for spaces, there is no punctuation in the sentence.
4. There will always be at least two words in the sentence.
Example:
c = 'The quick brown fox jumps over the lazy dog';
a = 3.889;
Example:
c = 'Another one bites the dust';
a = 4.400;
The next problem in this series is Problem 44853.
Solution Stats
Solution Comments
Show commentsProblem Recent Solvers35
Suggested Problems
-
Find all elements less than 0 or greater than 10 and replace them with NaN
15689 Solvers
-
Sort a list of complex numbers based on far they are from the origin.
5730 Solvers
-
07 - Common functions and indexing 4
416 Solvers
-
352 Solvers
-
Calculate the square of a number (Super Easy)
187 Solvers
More from this Author45
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!