Practice #2
Lesson 11 of 12 in Coddy's File Handling in Python course.
Challenge
MediumWrite a function named average_word_length which gets a filename as argument and returns the average word length (rounded to two decimal points) in the file.
For example,
If input1.txt contains:
The quick brown fox jumps over the lazy dog. The dog barks, and the fox runs away.
Then average_word_length('input1.txt') returns 3.71
Note: remove any punctuation!
Try it yourself
def average_word_length(filename):
# Write code here