Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:11,550 --> 00:00:13,860
Hi, everyone, and welcome in this new review.
2
00:00:15,000 --> 00:00:18,840
In this video, we're going to talk about string in Python.
3
00:00:20,230 --> 00:00:26,230
A string is just a way to contain texts in our.
4
00:00:26,980 --> 00:00:35,050
So a string is very useful, for example, if you want to display some information, for example.
5
00:00:35,350 --> 00:00:48,820
So if you want to create a very simple string, I open a pair of quotes and I put in a time and information
6
00:00:49,450 --> 00:00:53,320
and I can run the Senate using shift and serve.
7
00:00:54,010 --> 00:00:58,120
But here we can see that we have.
8
00:00:58,450 --> 00:01:00,160
We still have the quote.
9
00:01:00,820 --> 00:01:15,340
If you want to delete the quotes, we can use the print function, which will allow us to return some
10
00:01:15,910 --> 00:01:17,860
string without the quotes.
11
00:01:18,160 --> 00:01:22,180
Only the content of the quotes of the string.
12
00:01:22,180 --> 00:01:22,510
So you.
13
00:01:25,620 --> 00:01:37,440
So now we are going to see how to have a tabulation in a stream, so it can be very useful, for example,
14
00:01:37,560 --> 00:01:38,670
when you do.
15
00:01:39,240 --> 00:01:44,880
I don't know about this and you want to display some metrics.
16
00:01:45,210 --> 00:01:57,960
So to do it, for example, we can do it like this meme is equal to 10 percent and volatility in 10
17
00:01:57,960 --> 00:01:58,410
percent.
18
00:02:00,700 --> 00:02:14,560
But the problem with this way to right it is that it will be very difficult to see.
19
00:02:16,720 --> 00:02:20,730
Which value is associated?
20
00:02:21,190 --> 00:02:30,100
To which metrics so we can have a tabulation, to a better visualization of our metrics?
21
00:02:30,370 --> 00:02:41,020
So to do and tabulation, we need to put a backslash key operator in the string like this and then.
22
00:02:47,970 --> 00:02:49,440
We have a tabulation.
23
00:02:50,880 --> 00:02:54,180
We can also skip the line if we want.
24
00:02:54,510 --> 00:03:04,800
So to do it, we just have to put the backslash and operator in the street and then we have skipped
25
00:03:05,070 --> 00:03:05,610
a line.
26
00:03:05,790 --> 00:03:14,070
So we have to re, for example, for all you political backrests to display our metrics.
27
00:03:17,900 --> 00:03:23,220
Now we have seen only the very simple way to create a stream.
28
00:03:24,060 --> 00:03:27,210
Sometimes a simple stream is not enough.
29
00:03:27,300 --> 00:03:29,910
We need to create a dynamic stream.
30
00:03:31,170 --> 00:03:31,630
Why?
31
00:03:31,680 --> 00:03:42,120
For example, if you have created an algorithm and each day you want to see the price of an asset,
32
00:03:42,120 --> 00:03:54,900
for example, Tesla, if you create a simple string, you like this Tesla stock price.
33
00:03:58,790 --> 00:03:59,990
At date.
34
00:04:07,240 --> 00:04:14,260
For example, each day, we need to change it manually.
35
00:04:14,770 --> 00:04:22,570
The value so there is no need to put a string if each day we need to change it.
36
00:04:23,320 --> 00:04:27,850
So now we need to use the former function.
37
00:04:30,150 --> 00:04:43,320
In our street, so to do it, we are going to put an empty pair of brothers when you want to add a dynamic.
38
00:04:43,600 --> 00:04:43,950
Found you.
39
00:04:44,190 --> 00:04:49,470
So for us is for the price and for the date.
40
00:04:49,800 --> 00:04:50,130
So.
41
00:04:54,980 --> 00:05:08,090
Then we need to put the former function, and now we need to specify the value, for example this and.
42
00:05:12,200 --> 00:05:12,560
That's.
43
00:05:14,740 --> 00:05:14,980
It's.
44
00:05:17,110 --> 00:05:30,280
Actually, it doesn't make any sense, because now we have also put the value manually, but it will
45
00:05:30,280 --> 00:05:37,440
be very interesting when we are going to walk with a variable in the next video.
46
00:05:37,450 --> 00:05:47,560
So it is very important to understand the way to create the dynamic string, even if now we don't have
47
00:05:47,800 --> 00:05:51,610
a will interest to use it because we don't know variable.
48
00:05:51,610 --> 00:06:02,590
But when we are going to see the variable, this type of string will be very interesting.
49
00:06:04,090 --> 00:06:08,770
So another way to create a more dynamic string is the F Street.
50
00:06:09,280 --> 00:06:16,870
So to do it, we just put a f before the string and.
51
00:06:20,130 --> 00:06:26,360
We put exactly the same string and.
52
00:06:28,550 --> 00:06:32,240
Between the buses, we need to put the variable.
53
00:06:32,480 --> 00:06:37,130
So for us now is just some value.
54
00:06:39,510 --> 00:06:39,870
But
55
00:06:43,170 --> 00:06:47,280
later, it will be very interesting to walk with that.
56
00:06:49,050 --> 00:06:54,000
No, I just want to show you a little specificity.
57
00:06:56,290 --> 00:07:07,600
Since the beginning of the radio, I only write string using a double crypt, but it is important to
58
00:07:07,600 --> 00:07:12,760
know that you can create a string using duplicate or similar quotes.
59
00:07:13,150 --> 00:07:17,200
And here it is mandatory to use simple quotes.
60
00:07:17,380 --> 00:07:24,130
Why is it because we already own in a string?
61
00:07:24,640 --> 00:07:26,220
So if here?
62
00:07:26,320 --> 00:07:36,550
So if you agree to put double quotes, Biton doesn't understand that this.
63
00:07:38,210 --> 00:07:50,480
Is a string inside this big tree, so there is a never so it is really mandatory to put single.
64
00:07:51,880 --> 00:08:09,050
Quote, you know, we are going to see how to round a number into a string, so to do it is really simple.
65
00:08:09,070 --> 00:08:16,900
So I will take only the price of Tesla because they cannot be around.
66
00:08:19,360 --> 00:08:25,360
So in real life, the price of Tesla is.
67
00:08:27,700 --> 00:08:30,110
With many no.
68
00:08:30,250 --> 00:08:34,870
After the point, for example, we can have a price like this.
69
00:08:35,500 --> 00:08:40,570
But for us, all this number, for example.
70
00:08:43,070 --> 00:08:44,990
Or not significant.
71
00:08:45,890 --> 00:08:56,420
So we want to run our no to have a better really visualization when we are going to display this stream
72
00:08:57,020 --> 00:08:57,680
to do it.
73
00:08:59,030 --> 00:09:02,000
We need to use this operative so.
74
00:09:13,850 --> 00:09:20,540
This operator means that we are going to run this number.
75
00:09:22,560 --> 00:09:27,180
With Chew member after the point.
76
00:09:30,750 --> 00:09:37,090
If I change the two in three, for example, we will have three.
77
00:09:37,410 --> 00:09:50,310
If I put one, we have only one, etcetera, then we have one things to do before finished this video,
78
00:09:50,790 --> 00:09:53,910
which is the slicing on a stream.
79
00:09:55,380 --> 00:10:03,090
For example, if I take our first stream, I'm information.
80
00:10:04,050 --> 00:10:05,670
Sometimes we want
81
00:10:08,700 --> 00:10:13,170
to extract some rolled over later to do it.
82
00:10:13,590 --> 00:10:17,930
We can put a pair of broke.
83
00:10:19,110 --> 00:10:26,650
And if you want only a later, you can have the index of this letter.
84
00:10:26,700 --> 00:10:31,230
So in Python, we begin to count from zero.
85
00:10:31,840 --> 00:10:36,810
So the eye here is at index zero.
86
00:10:37,500 --> 00:10:43,070
So if I launch the code, we have only the eye.
87
00:10:43,350 --> 00:10:56,490
If I want the road, for example, we put a double point to say to tell to Python that we want this.
88
00:10:58,540 --> 00:11:09,790
Part of this string is so if I want this, for example, I will put the zero firm from zero to six and
89
00:11:10,120 --> 00:11:10,900
I will have.
90
00:11:13,330 --> 00:11:21,640
Only this part of the string, so it is also important to understand it because sometimes in your own
91
00:11:21,640 --> 00:11:32,650
project, it will be very, very, very interesting to know this slicing on a string because it will
92
00:11:32,860 --> 00:11:34,900
avoid you a lot of work.
93
00:11:35,140 --> 00:11:43,750
So again, I really invite you to play you with all this new operation.
94
00:11:43,960 --> 00:11:52,060
And if you have any problems, you can ask in the Discord forum and the link is here.
8769
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.