00:01
Okay, so this question says, give a program that will create a file named text .t.
00:07
And write 10 sentences as a file if it's storage is one sentence per line.
00:11
The function that reads the file's contents and calculates the average number of words per sentence.
00:20
Okay, let's do it.
00:22
So let's start off by saying f equals open, text .t x .t, and then want to be writable.
00:31
So we're going to write this thing.
00:35
Now we're going to do while and now we're going to do 4.
00:40
I in range 10.
00:46
My text equals input, input text.
00:54
And then we're going to do f .org write my text.
01:03
And at the end of that, we're going to do f.
01:05
Close.
01:06
So let's do that.
01:08
So we can put in a bunch of stuff.
01:10
We have to do this 10 times, which is kind of a lot.
01:14
There it is.
01:15
Okay, there it is.
01:16
That does that.
01:19
And we take a look at that file.
01:26
We can see that it has all this nonsense in it.
01:31
And one thing i've dropped put in here actually is that we also want to write plus x -slash -tend.
01:36
We want each sentence to be separated.
01:39
So if we do this, then we get separate.
01:44
Separated bed line.
01:48
So next thing we want to do is give a function that reads the files contents and calculate is the average number of words...