# Word Analysis

## Objective

To gain experience writing programs with loops, if statements, and strings.

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 some 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".

## Details

• Your program should start by asking the user how many words they would like to enter. Save this number into a variable.
• Then you will create a for loop to loop that many times.
• You will also need a variable for keeping track of the total length of the words the user enters.
• Inside the loop, read the next word from the user. You can then find the length of it with len, and add this length into your total length variable. You can assume the user's words will have no spaces or punctuation.
• At the end of the loop, you should have the total length of all the words they entered. You can then divide that by the number of words to get the average.
• You should then round the average to the nearest 2 decimal places, using round.
• Finally, you should then print out the average word length along with the difficulty rating of easy, medium or hard.

## Example Run

Here is a couple example runs of the average word length program:

How many words will you enter? 11
Next word: Spot
Next word: is
Next word: a
Next word: dog
Next word: Spot
Next word: likes
Next word: to
Next word: run
Next word: See
Next word: spot
Next word: run
Average Length = 3.09
Easy

How many words will you enter? 5
Next word: calculations
Next word: ergonomic
Next word: complicated
Next word: gibberish
Next word: zoological
Average Length = 10.2
Hard

How many words will you enter? 2
Next word: in
Next word: between
Average Length = 4.5
Medium


## General Requirements

When writing your program, also be sure to:

• Put a comment at the top of your program with your name, the name of the program, and the purpose of the program.
• Use good variable names (like "speed" and "time" instead of "x" and "y").
• Test your program before turning it in. Double check the answers your program gives to make sure it's working properly.

## Submitting

When you are finished, please submit the .py file for the assignment on Canvas.