One simple way of estimating the reading difficulty of a piece of text is to calculate the average word length. Estimating reading difficulty is used by elementary educators to determine how difficult a story may be for children of different ages to read. Stories with shorter average word length will generally be easier to read.
For example the text:
Spot is a dog. Spot likes to run. See spot run.
Has an average word length of 3.09.
On the other hand, the text:
In interpolating problems, spline interpolation is often referred to as polynomial interpolation.
Has an average word length of 7.0
You will write a program that will take in a sequence of words from the user and print out the average word length. Along with the word length, you should print out a difficulty rating of "easy", "medium" or "hard". If a piece of text has an average word length of less than 4, it should be classified as easy. If the average word length is greater than or equal to 4, but less than 6, it should be classified as medium. And if the average word length is greater than or equal to 6, it should be considered hard.
Copyright © 2018 Ian Finlayson | Licensed under a Creative Commons Attribution 4.0 International License.