1
00:00:00,960 --> 00:00:01,589
Yesterday.

2
00:00:01,589 --> 00:00:06,210
We completely changed the way our users interact with the program.

3
00:00:06,840 --> 00:00:15,510
So now we allow the user to enter A to do here on the fly and fix the bug, for example.

4
00:00:15,540 --> 00:00:19,350
You press that and it is added to the to do items.

5
00:00:21,420 --> 00:00:29,250
Now to be able to do that, we had to change from match case to if Elif else.

6
00:00:30,090 --> 00:00:33,360
So now we check for expressions.

7
00:00:33,360 --> 00:00:39,960
So if ads is in the user action string user action is what we get from the user.

8
00:00:40,320 --> 00:00:43,950
So they enter ads followed by the to do and so on.

9
00:00:43,950 --> 00:00:46,920
So we check if the part ad is in that.

10
00:00:47,790 --> 00:00:49,140
User input.

11
00:00:50,730 --> 00:00:57,750
And then we extract the to do from the user action and we use list slicing for that.

12
00:00:58,440 --> 00:01:06,180
So we only get the characters that come after add so for and everything after for.

13
00:01:07,490 --> 00:01:10,820
And then we read the file to get the existing to dos.

14
00:01:10,820 --> 00:01:18,170
We append the new to do to the to do list and we write the update to this list.

15
00:01:18,860 --> 00:01:21,410
So then we have a live.

16
00:01:23,870 --> 00:01:32,720
So what happens is that if the user entered ad, this block will be executed and these other blocks

17
00:01:32,720 --> 00:01:37,460
will not be executed at all, which makes the code efficient.

18
00:01:38,000 --> 00:01:45,560
But if the user entered something else, the program will check If AD is in user action, it will not

19
00:01:45,560 --> 00:01:53,720
execute this, but then it will check the next l if condition so l if show then it executes this.

20
00:01:55,080 --> 00:01:57,990
We didn't change anything from the showcase.

21
00:01:59,500 --> 00:02:00,790
If the user enters.

22
00:02:00,820 --> 00:02:01,570
Edit.

23
00:02:02,470 --> 00:02:13,180
Again, we extract the part after edits using list slicing, and then we added the existing to the item

24
00:02:13,180 --> 00:02:14,590
as we did before.

25
00:02:14,620 --> 00:02:16,030
The same goes for complete.

26
00:02:16,030 --> 00:02:17,470
We use list slicing.

27
00:02:19,400 --> 00:02:21,830
We get everything after the ninth character.

28
00:02:22,040 --> 00:02:34,010
And so one other wise, we have this else case here, which is the case where the user didn't answer

29
00:02:34,010 --> 00:02:36,050
any of these commands.

30
00:02:36,050 --> 00:02:44,840
So they didn't enter ad they didn't enter, show, not edit, not complete, not exit, but something

31
00:02:44,840 --> 00:02:45,190
else.

32
00:02:45,200 --> 00:02:48,820
In that case we say, Oh, your command is valid, it's not valid.

33
00:02:48,830 --> 00:02:51,110
So that's what we did yesterday.

34
00:02:52,250 --> 00:02:58,910
Today we're going to improve the program even further and learn new Python features.

35
00:02:58,910 --> 00:03:00,650
So I'll talk to you in the next video.

