00:01
Okay, this question says, create a python program that reads in the file, inputt .ttx download and outputs to a file.
00:12
Each line of the input file preceded by the line number and then the total number of lines in the file, name the output file, output .com.
00:21
So here's an example.
00:29
Okay, so i'm just going to quickly create this file, i guess.
00:38
Obviously i don't have your input files, so i need to have something to do with that.
00:44
So i'm going to say f equals open input .txtee and make that writable.
00:53
And i'm going to say my stir is equal to dogs, bark, x slash n, at now.
01:17
That's all i'm going to do because it doesn't really not doesn't specify how long it wants.
01:23
I'm going to do f.
01:23
Write my stir then i'm going to do f.
01:28
Close.
01:30
Okay, so pretend that never happened now because we're going to write our programs.
01:34
Let's do the first part says we're going to read in this file.
01:38
So we're going to do f .f equals open input .t .xc as a readable file.
01:44
And we're going to do contents equals f.
01:48
Read and then we're going to do f -dark close so now we have the contents and that's exactly what i put in there and so let's split this by let's do content list equals contents dot split by back slash and so it's going to split it by line and then we have content list dog bark cats me out so what we're going to do now is we want to add the input line to each of these.
02:33
So let's do this.
02:36
So we're going to loop through our content list.
02:39
And let's make a string called outstring...