1
00:00:02,460 --> 00:00:05,670
Yesterday, we made a big change in our program.

2
00:00:05,670 --> 00:00:12,330
We changed the way the data is stored because before yesterday the data was simply stored in variables

3
00:00:12,330 --> 00:00:17,430
and that meant whenever the user closed the program, the data would get lost.

4
00:00:18,210 --> 00:00:22,620
So the user experience couldn't be more terrible than that.

5
00:00:23,550 --> 00:00:27,960
We change all that by storing the data in a text file.

6
00:00:29,160 --> 00:00:29,920
And this too.

7
00:00:29,940 --> 00:00:32,189
Does the text text file?

8
00:00:34,940 --> 00:00:38,810
To implement that We did this changes in the code.

9
00:00:40,300 --> 00:00:47,890
So when the user wants to add a to do, we get the to do from the user using an input function again

10
00:00:47,920 --> 00:00:54,790
and then we see what existing to dos we have in the file.

11
00:00:54,790 --> 00:00:56,920
So we open the file in read mode.

12
00:00:56,920 --> 00:00:58,540
You see our here.

13
00:01:04,090 --> 00:01:07,990
And we store the tattoos in a to do list.

14
00:01:08,920 --> 00:01:16,150
So we need to have that list because later we append the user to do and this to this list.

15
00:01:19,610 --> 00:01:24,350
And then, of course, this to do list has to be written back to the file.

16
00:01:24,380 --> 00:01:27,290
To do that, we open the file in write mode.

17
00:01:28,980 --> 00:01:31,800
And that's overwrites the existing file.

18
00:01:32,850 --> 00:01:35,550
But that's okay, because we already have.

19
00:01:36,640 --> 00:01:39,120
The content that the file had.

20
00:01:39,130 --> 00:01:41,290
So we have it dos.

21
00:01:41,740 --> 00:01:44,800
Therefore, we write the to do list in the file.

22
00:01:44,800 --> 00:01:53,800
So now the to this list will contain the existing data plus the new to do which will was added in here.

23
00:01:54,430 --> 00:01:57,790
And so we close the file here and we are done with that.

24
00:02:00,420 --> 00:02:07,470
We also implemented this in the show methods and here we only wanted to read Delta, so we only open

25
00:02:07,470 --> 00:02:08,759
the file and read mode.

26
00:02:08,789 --> 00:02:09,900
As you can see in here.

27
00:02:14,310 --> 00:02:21,590
We get the data in a to do list, we close the file and then we iterate over that to to list.

28
00:02:22,170 --> 00:02:24,120
So to this list was created here.

29
00:02:24,120 --> 00:02:29,340
We iterate in here and we print out the data as we did before.

30
00:02:30,150 --> 00:02:32,340
So that's what we did previously.

31
00:02:34,310 --> 00:02:38,570
We still have to make some important changes to our program.

32
00:02:38,570 --> 00:02:39,710
We still have to improve it.

33
00:02:39,710 --> 00:02:42,730
So let's improve it in the next videos today.

34
00:02:42,770 --> 00:02:43,280
So you.

