WEBVTT

00:00.080 --> 00:01.040
Welcome back.

00:01.080 --> 00:02.720
We finished the operators.

00:02.760 --> 00:05.960
Now let's move to printing and string basics.

00:06.120 --> 00:10.760
We use print function to display output.

00:10.920 --> 00:15.040
You can combine string using the plus sign.

00:15.320 --> 00:18.040
This is called concatenation.

00:18.080 --> 00:26.440
For example we have this variable called first name and its value is Bob last name and its value Smith.

00:26.480 --> 00:30.400
We have a variable called full name.

00:30.440 --> 00:40.400
This full name is a combination and concatenation of the first name plus a space plus the last name.

00:40.440 --> 00:44.880
Let me print hello and the full name.

00:45.120 --> 00:47.320
Run this cell and here we go.

00:47.640 --> 00:53.280
We have hello comma space and the full name.

00:53.400 --> 00:55.560
The full name is this variable.

00:55.760 --> 01:02.400
This variable is a concatenation between the first name string and the last name string.

01:02.600 --> 01:03.080
Okay.

01:03.120 --> 01:10.880
So did you did you understand this concatenation string strings in Python are surrounded by either single

01:10.880 --> 01:14.040
quotation mark or double quotation mark.

01:14.200 --> 01:16.880
So I can write like this.

01:16.880 --> 01:21.600
Smith in in single quotation or in double quotation.

01:21.640 --> 01:22.160
Okay.

01:22.320 --> 01:26.720
You can display a string literal with a print function.

01:26.720 --> 01:31.360
So we use this print function to display the string literals.

01:31.400 --> 01:37.200
Also we can get the length of the string using the Len function.

01:37.400 --> 01:43.440
So here let me try to use print length of the full name.

01:43.480 --> 01:45.480
Run the cell again we have.

01:45.480 --> 01:48.520
This error can only concatenate string, not integer.

01:48.520 --> 01:51.800
So I remove this and run again.

01:51.800 --> 01:52.720
And here we go.

01:53.040 --> 01:57.480
We have nine characters in the full name.

01:57.520 --> 02:00.760
In the next videos we're going to talk about the functions.

02:00.760 --> 02:03.560
But don't worry, we'll clarify everything.

02:03.680 --> 02:10.320
Also, we can use f strings formatted strings for easier formatting.

02:10.560 --> 02:14.240
For example, age equals to 30.

02:14.280 --> 02:20.280
Instead of writing every time the plus and the concatenation.

02:20.280 --> 02:23.840
In this way we can use this way.

02:24.160 --> 02:27.160
So print f the formatted.

02:27.160 --> 02:30.350
My name is full name.

02:30.350 --> 02:36.590
We include the variable in between those parentheses and I am age.

02:36.590 --> 02:44.110
You can notice that that the age is another variable included between those parentheses.

02:44.110 --> 02:50.230
And by the way there is a different color from the normal string.

02:50.230 --> 02:51.950
So this is the normal string.

02:52.070 --> 02:56.710
And this is the literal that it will be printed at it.

02:56.710 --> 03:01.590
But the variable will be printed according to its value.

03:01.630 --> 03:04.070
Let me run again and here we go.

03:04.350 --> 03:06.910
My name is Bob Smith.

03:07.110 --> 03:15.070
Full name variable is replaced by the concatenated variable used before and I am.

03:15.110 --> 03:22.430
Here we replace the age with the value of the age variable years old okay.

03:22.710 --> 03:30.270
So this is the formatted strings and this is the concatenation and the strings in Python.

03:30.510 --> 03:33.190
Or there are a lot of things about strings.

03:33.190 --> 03:40.270
But we are interested in things that are useful for our course machine learning.
