1
00:00:01,620 --> 00:00:02,580
Hey, welcome back.

2
00:00:03,360 --> 00:00:09,030
As you have noticed, through all the calls, we have been doing two main things, which is adding new

3
00:00:09,030 --> 00:00:13,200
features and then improving the user experience.

4
00:00:13,530 --> 00:00:20,970
So these are two phases that you have to go through over the lifecycle, the development lifecycle of

5
00:00:20,970 --> 00:00:21,960
your program.

6
00:00:22,950 --> 00:00:27,540
And in this video, we will be improving the user experience again.

7
00:00:27,840 --> 00:00:30,500
What exactly will be doing is this?

8
00:00:30,510 --> 00:00:37,770
So let's say the user is adding new to DOS in order to do list, and I show that to dos and they want

9
00:00:37,770 --> 00:00:39,180
to add it to something.

10
00:00:39,480 --> 00:00:46,590
But in order to say what they want to add it, they want to they have to count currently 1 to 3 and

11
00:00:46,590 --> 00:00:48,390
maybe they decide on number three.

12
00:00:48,390 --> 00:00:49,630
So they enter three there.

13
00:00:49,650 --> 00:00:52,840
So we want to make this experience flawless.

14
00:00:52,860 --> 00:01:00,090
We want to show numbers in front of each to do so that the user can simply look at the number and then

15
00:01:00,090 --> 00:01:03,270
write the number there so they don't have to count.

16
00:01:03,900 --> 00:01:05,280
How do we do that?

17
00:01:05,519 --> 00:01:06,270
Well.

18
00:01:08,680 --> 00:01:15,040
We have to look at where we are printing out those items, which is in here.

19
00:01:15,250 --> 00:01:18,010
So we produce that list.

20
00:01:18,890 --> 00:01:20,630
Using this for loop.

21
00:01:20,630 --> 00:01:24,920
The for loop goes over to to dos and prints out its each item.

22
00:01:25,340 --> 00:01:30,890
Now the solution to show numbers in front is the enumerate function.

23
00:01:30,920 --> 00:01:33,620
Let me demonstrate to you what enumerate is.

24
00:01:33,620 --> 00:01:43,100
So let's say we have to do list currently, which is let's say, clean through and do that.

25
00:01:43,100 --> 00:01:44,690
At least we have this point.

26
00:01:44,690 --> 00:01:47,090
So we have we have that list in here.

27
00:01:47,090 --> 00:01:48,170
We want to show that.

28
00:01:48,170 --> 00:01:53,300
So currently what we do is for item into dos print item.

29
00:01:55,550 --> 00:01:56,080
Right.

30
00:01:56,090 --> 00:01:57,950
We execute and we get the list.

31
00:01:57,980 --> 00:02:05,960
Now, what we want to do is we want to go back in here and say Enumerate, which is a function.

32
00:02:05,960 --> 00:02:09,530
And this function gets as inputs a list.

33
00:02:09,949 --> 00:02:18,560
So the list goes as the inputs of enumerate, function and enumerate function now makes available not

34
00:02:18,560 --> 00:02:23,090
only the items of the list, but also the indices of that list.

35
00:02:23,820 --> 00:02:26,460
So we're going to get two elements from here.

36
00:02:26,460 --> 00:02:37,620
Therefore, we need two variables for eye or index for index and item in enumerate to dos print item,

37
00:02:38,580 --> 00:02:40,380
and we also print index.

38
00:02:40,890 --> 00:02:44,880
So index and item to go down here, press enter.

39
00:02:45,570 --> 00:02:47,340
And so this is what we get.

40
00:02:49,670 --> 00:02:57,230
So what's happened is that we print out the index in the first iteration and also the item.

41
00:02:57,230 --> 00:03:05,150
So in the first iteration, the full loop goes and gets it gets clean and it's index zero.

42
00:03:05,150 --> 00:03:10,400
So it stores clean in the item variable and zero in the index variable.

43
00:03:10,490 --> 00:03:14,750
And therefore and here we print out zero and clean.

44
00:03:15,140 --> 00:03:18,200
It does the same for the other indexes and other items.

45
00:03:19,310 --> 00:03:25,190
So let's go back to our code now and implement the same enumerate function.

46
00:03:25,190 --> 00:03:39,530
So for index item in enumerate to do's print index item if you want, you can also add a third argument

47
00:03:39,560 --> 00:03:43,010
in between here, which could be a string.

48
00:03:43,040 --> 00:03:53,090
Single quotes should be enough dot perhaps, or a dash, whatever you like and let's see what we will

49
00:03:53,090 --> 00:03:53,750
get.

50
00:03:53,780 --> 00:03:56,840
So run, stop and rerun.

51
00:03:56,840 --> 00:04:02,150
Add through, add, do show.

52
00:04:02,870 --> 00:04:04,400
Yep, that's what we get.

53
00:04:05,690 --> 00:04:07,250
So it's looking better.

54
00:04:07,610 --> 00:04:09,290
Not ideal though.

55
00:04:09,470 --> 00:04:16,940
I would prefer not to have these spaces or at least the space between the dash and through.

56
00:04:18,010 --> 00:04:20,990
So how can we change the format of this text?

57
00:04:21,010 --> 00:04:23,170
How can we remove that space?

58
00:04:24,220 --> 00:04:24,640
Here.

59
00:04:24,640 --> 00:04:33,490
We don't seem to have any spaces, so we don't have much control over this thing when we use this sprint

60
00:04:33,490 --> 00:04:34,240
function.

61
00:04:34,540 --> 00:04:39,130
But we can get control over that if we use F strings.

62
00:04:39,340 --> 00:04:42,580
F strings is something we're going to be using in the next video.

63
00:04:42,580 --> 00:04:43,750
So I'll talk to you there.

