00:01
Okay, so let's write a python program that will give us the average length of all the words in a sentence.
00:07
So let's define this as a function.
00:11
We'll call it average length, and we'll take in a sentence as input.
00:19
So what we first want to do is to take the length of all the words in a sentence.
00:24
We want to first split up the sentence into a list of words that we can take the length of.
00:28
So python, since sentence is a string, we know that we can simply just do the method.
00:39
We can get words lists.
00:42
The word list is just equal to sentence.
00:47
Since it's a string.
00:51
And it's going to give us a word, a list of each of the words in the sentence.
00:56
And we can use a nice list comprehension method to get the lengths of all the words...