All right.
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, SDR, which stands for Strengths.
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 to note that we want to 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 and now we can use this in important ways.
For example, imagine you're creating a login form and we want to collect somebodies username and password.
Well we can have username variable that we assign, let's say some sort of username.
Let's call it super coder.
And then password can be super secret.
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.
All right.
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 a 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, a threat with a quote doesn't mean
anything.
But if we use three single quotes, you can see that we can do multiple line strings.
And this is really useful if you want to have maybe long sentences and paragraphs.
Now with a string we do 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?
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 of 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 Andre to Nagoya.
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.