In the previous video, we use the enumerate function to access the items, but also the indexes of
the to do list.
And we ended up with this output.
Now we want to improve this output.
So we want to define if we want a space or not.
The answer here is f string.
So let me demonstrate to you what f strings are.
So let's suppose we are in the first iteration of the loop, and in that current iteration, perhaps
index is one and the item variable is the string through.
Right.
We have two variables now.
How do we get a text to look something like, you know, one?
Throw or one throw like that.
How do we construct a text like that?
Well, the answer is f strings, so let's say.
The ro variable is equal to F and double quotes.
Double quotes here.
So inside goes the F string.
What is an F string?
Well, an F string is something that contains these brackets.
And in these curly brackets you can enter a variable.
So let's say you enter index and then after that perhaps you want a dash, perhaps you want to smile
you.
And after that, you may want another valuable item, for example.
Execute that and see that ROE now is the string.
So what's happened is that index.
So that part was replaced with the value of the index variable, which is one.
Then we have a literal string.
So this part here is just characters.
They are not inside curly brackets.
So explicit, literal string.
It shows like that as it is.
And then this part is also replaced by the actual value of the item variable.
So that's what we get.
We can make use of this now and here.
So let's say a row is equal to F again and index a dash and item.
That should be enough.
Oh, and then we need to print row.
Of course, if you want to show it on the command line.
Otherwise, you you'll not get any output.
So add clean and scrape show and that's the output.
So I think it looks better now.
Feel free to use any characters here.
So not a dash, but maybe a dot.
Make sense more for you.
And that's about F strings.
So like that, you can place as many variables inside the F string as you want and you always need to
use F.
Otherwise, this string will not accept those curly brackets.
Well, it will accept them.
You can do like that.
Index, but that will be read as a literal string.
So index will not be recognized as a variable if you don't have that f in front of the double quotes.
I hope this makes sense and I'll see you later.