Welcome back.
We finished the operators.
Now let's move to printing and string basics.
We use print function to display output.
You can combine string using the plus sign.
This is called concatenation.
For example we have this variable called first name and its value is Bob last name and its value Smith.
We have a variable called full name.
This full name is a combination and concatenation of the first name plus a space plus the last name.
Let me print hello and the full name.
Run this cell and here we go.
We have hello comma space and the full name.
The full name is this variable.
This variable is a concatenation between the first name string and the last name string.
Okay.
So did you did you understand this concatenation string strings in Python are surrounded by either single
quotation mark or double quotation mark.
So I can write like this.
Smith in in single quotation or in double quotation.
Okay.
You can display a string literal with a print function.
So we use this print function to display the string literals.
Also we can get the length of the string using the Len function.
So here let me try to use print length of the full name.
Run the cell again we have.
This error can only concatenate string, not integer.
So I remove this and run again.
And here we go.
We have nine characters in the full name.
In the next videos we're going to talk about the functions.
But don't worry, we'll clarify everything.
Also, we can use f strings formatted strings for easier formatting.
For example, age equals to 30.
Instead of writing every time the plus and the concatenation.
In this way we can use this way.
So print f the formatted.
My name is full name.
We include the variable in between those parentheses and I am age.
You can notice that that the age is another variable included between those parentheses.
And by the way there is a different color from the normal string.
So this is the normal string.
And this is the literal that it will be printed at it.
But the variable will be printed according to its value.
Let me run again and here we go.
My name is Bob Smith.
Full name variable is replaced by the concatenated variable used before and I am.
Here we replace the age with the value of the age variable years old okay.
So this is the formatted strings and this is the concatenation and the strings in Python.
Or there are a lot of things about strings.
But we are interested in things that are useful for our course machine learning.