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 strings.
We'll 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 and 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 it is also let's do print so that we can see the display and
I click Run you see that it's SDR.
It's a type of string.
Now we can use this in important ways.
For example imagine you're creating a log in form and we want to collect somebodies username and password.
Well we can have user name variable that we assign let's say some sort of user name 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 while we can do here is three single quotes in a row like this.
And then here I can just say wow maybe so a pair of eyes of somebody that's really impressed.
And let's go with a mouth that actually kind of looks like here.
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 four 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 caret 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 want to have maybe long sentences and paragraphs.
Now with a string we use 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 a 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 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 spacing 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 and 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.