1
00:00:01,480 --> 00:00:08,560
In the previous video, we use the enumerate function to access the items, but also the indexes of

2
00:00:09,280 --> 00:00:10,420
the to do list.

3
00:00:10,420 --> 00:00:13,570
And we ended up with this output.

4
00:00:13,600 --> 00:00:17,080
Now we want to improve this output.

5
00:00:17,200 --> 00:00:20,830
So we want to define if we want a space or not.

6
00:00:21,130 --> 00:00:22,960
The answer here is f string.

7
00:00:22,970 --> 00:00:25,870
So let me demonstrate to you what f strings are.

8
00:00:27,220 --> 00:00:33,550
So let's suppose we are in the first iteration of the loop, and in that current iteration, perhaps

9
00:00:33,550 --> 00:00:40,600
index is one and the item variable is the string through.

10
00:00:41,910 --> 00:00:42,450
Right.

11
00:00:42,690 --> 00:00:45,180
We have two variables now.

12
00:00:45,180 --> 00:00:50,730
How do we get a text to look something like, you know, one?

13
00:00:52,490 --> 00:00:56,540
Throw or one throw like that.

14
00:00:57,200 --> 00:00:59,600
How do we construct a text like that?

15
00:00:59,870 --> 00:01:02,960
Well, the answer is f strings, so let's say.

16
00:01:04,140 --> 00:01:10,620
The ro variable is equal to F and double quotes.

17
00:01:11,400 --> 00:01:12,380
Double quotes here.

18
00:01:12,390 --> 00:01:13,400
Double quotes here.

19
00:01:13,410 --> 00:01:16,760
So inside goes the F string.

20
00:01:16,770 --> 00:01:18,150
What is an F string?

21
00:01:18,150 --> 00:01:23,130
Well, an F string is something that contains these brackets.

22
00:01:23,130 --> 00:01:27,720
And in these curly brackets you can enter a variable.

23
00:01:28,380 --> 00:01:34,350
So let's say you enter index and then after that perhaps you want a dash, perhaps you want to smile

24
00:01:34,350 --> 00:01:34,680
you.

25
00:01:35,940 --> 00:01:40,170
And after that, you may want another valuable item, for example.

26
00:01:41,790 --> 00:01:46,170
Execute that and see that ROE now is the string.

27
00:01:46,770 --> 00:01:49,380
So what's happened is that index.

28
00:01:50,280 --> 00:01:55,020
So that part was replaced with the value of the index variable, which is one.

29
00:01:55,350 --> 00:01:57,120
Then we have a literal string.

30
00:01:57,120 --> 00:02:00,330
So this part here is just characters.

31
00:02:00,330 --> 00:02:02,880
They are not inside curly brackets.

32
00:02:03,950 --> 00:02:06,170
So explicit, literal string.

33
00:02:07,160 --> 00:02:08,949
It shows like that as it is.

34
00:02:08,960 --> 00:02:16,100
And then this part is also replaced by the actual value of the item variable.

35
00:02:16,940 --> 00:02:18,590
So that's what we get.

36
00:02:18,620 --> 00:02:21,140
We can make use of this now and here.

37
00:02:22,880 --> 00:02:30,350
So let's say a row is equal to F again and index a dash and item.

38
00:02:30,350 --> 00:02:31,490
That should be enough.

39
00:02:33,560 --> 00:02:35,360
Oh, and then we need to print row.

40
00:02:35,390 --> 00:02:38,960
Of course, if you want to show it on the command line.

41
00:02:39,080 --> 00:02:41,330
Otherwise, you you'll not get any output.

42
00:02:41,990 --> 00:02:51,590
So add clean and scrape show and that's the output.

43
00:02:52,220 --> 00:02:54,230
So I think it looks better now.

44
00:02:54,680 --> 00:02:56,580
Feel free to use any characters here.

45
00:02:56,600 --> 00:02:58,340
So not a dash, but maybe a dot.

46
00:02:58,340 --> 00:02:59,780
Make sense more for you.

47
00:03:01,040 --> 00:03:03,350
And that's about F strings.

48
00:03:03,350 --> 00:03:10,790
So like that, you can place as many variables inside the F string as you want and you always need to

49
00:03:10,790 --> 00:03:11,340
use F.

50
00:03:11,360 --> 00:03:17,010
Otherwise, this string will not accept those curly brackets.

51
00:03:17,060 --> 00:03:18,700
Well, it will accept them.

52
00:03:18,710 --> 00:03:21,710
You can do like that.

53
00:03:22,590 --> 00:03:28,710
Index, but that will be read as a literal string.

54
00:03:28,710 --> 00:03:35,650
So index will not be recognized as a variable if you don't have that f in front of the double quotes.

55
00:03:35,670 --> 00:03:38,160
I hope this makes sense and I'll see you later.

