Average Word Length

Published by supafly in

Create a function that takes in a sentence and returns the average length of each word in that sentence. Round your result to two decimal places.

Examples

AverageWordLength("A B C.") ➞ 1.00

AverageWordLength("What a gorgeous day.") ➞ 4.00

AverageWordLength("Dude, this is so awesome!") ➞ 3.80

Notes

Ignore punctuation when counting the length of a word.

Watch a quick demo on how Edabit works.