Andrei: Alright. We're almost,
kind of flying through this.
I know we're going slow here,
but trust me, once you get these data types,
things become a lot easier.
So we're just climbing that mountain
so that we can start looking at a higher level
at the language of Python.
To keep going,
let's talk about this data type.
Str, which stands for strings.
Let's see what they are.
A string is simply, well, a piece of text.
For example, a string can be written
with quotation marks,
and I can say, "Hi, hello there".
And that is a string.
You see that the color changed here in my editor.
I can also make strings with double quotes.
So once again, this is also a valid string.
And I can put anything I want in here,
I can do numbers, if I wanted to,
exclamation marks, it's just a piece of text.
You can think of it as a sentence for now.
And if I do the type function here,
remember these brackets denote
that we wanna perform some sort of action,
which is we're using the type action that Python gives us.
And if I click Run, you see that,
oh, and remember, we have to print it out as well,
so let's do print, so that we can see the display.
And I click Run.
You see that it's str, it's a type of string.
Now we can use this in important ways.
For example, imagine you're creating a login form,
and we wanna collect somebody's username and password.
Well, we can have username variable
that we assign let's say some sort of username,
let's call it supercoder.
And then password can be supersecret.
And now we have these variables, usernames and passwords,
that we can use throughout our program,
such as to check if a password exists.
And remember, I can use single quotes or double quotes.
But there's a third way that we can write strings in Python.
And this, well, is used for long strings.
So let's just create a variable long_string,
and what we can do here is three single quotes
in a row like this.
And then here, I can just say,
wow,
maybe, a pair of eyes of somebody
that's really impressed,
and let's go with a mouth.
That actually kind of looks like hair.
Alright.
And then I finish it off with three single quotes again.
So now if I print the long string,
and I click Run, look at that.
My little weird emoji face is printed.
So the three single quotes is for long strings
that I can keep going on multiple lines.
For example, I can't do this with the single quote.
You see that the orange color is now gone,
because Python is going to say,
this is a new line and this is another line,
and it's going to give me an error
because, well, ecret with a quote doesn't mean anything.
But if we use three single quotes,
you can see that we can do multi-line strings.
And this is really useful if you wanna have
maybe long sentences and paragraphs.
Now with a string,
we can do some cool things that we saw
in the numbers videos.
What if I had something like this.
Let's say I wanted to grab the first name of a user.
Just give my own name here.
And then last name.
And again, my super hard to pronounce last name.
Could we do something like this,
where we have full_name equals
to first_name,
plus last_name.
And then if we print here the full_name like this.
Should this work?
Well, let's have a look.
Let me remove this part here,
just so we have nice and clean looking code.
And if I click Run, there you go.
My name is printed,
but you see that there's no spaces here,
because we're going to use the addition sign
to attach Andrei to Neagoie,
but you can see that there's no spaces here.
So I can add a space if I wanted to,
or I can just simply create another string
inside of here,
just like this,
and then add a space in between.
So we're just using the plus sign,
which we've seen in the numbers videos,
but instead to add strings together.
And now if I click Run,
you see that I got the space,
because I'm adding a space in here,
in between the names.
Very, very cool.
But there's a few more neat things
that we can do with strings.
So let's take a break,
and I'll see you in the next video.