Everybody welcome to the next video.
So in this video we're going to be going over variables so a variable is a temporary storage location
in memory.
However in programming we're going to look at this from a it is a name of a temporary storage place
in memory.
So in an application or in programming as an example if we wanted to create a string which is just a
set of characters we can do sample string as equal to and then our quotes and then team patient.
Right.
So what happens here is we've got a name sample string which is now when this goes and runs through
the Python interpreter it's going to set this as a reference to a memory address that holds the data.
Red team nation.
Now the data itself is arbitrary as far as what I just explained.
It's still a reference to a memory location and then some sort of data and this particular case we're
using something called string.
This is just a sequence of characters you can have you know and any any other any data you want strings
characters special characters symbols does matter string will be able to handle it perfectly fine.
So what else we have is we have integers.
So if we have sample
entered we do it for.
Right.
So what you're noticing here is as if you've programmed before.
I'm not declaring the type of variable.
So in some languages you'd have to put string in front or end in front to reference that this this variable
is an integer or this variable here is a string python on the other hand will interpret this for you
based on the data provided.
So that's why we're not using any reference so to create an interest just a single set of numbers that
can go up to 2 billion I believe.
Next we have a sample float and this can be four.
All right.
So a float is a decimal point based no one see what else we got.
We have a sample bowling now a bowling is nothing but true or false.
In Python it's going to be capital T for true.
And then capital F for false.
Right.
So we'll set that to true sample.
None
calls.
Now none is a special because a special case none allows you it's set for essentially when you don't
initialize something or you don't provide a value to something it is going to default to none.
So in other languages you may you may know this is something called null or something empty.
It's nothing.
In most cases with Python if something fails or something errors out a return or the variable that's
being passed back if requested of one is tends to be none.
If there's some sort of error unless the developer decides to write something in a different way.
These have just been some examples.
We have our strings.
Just hold some characters are integers that hold digits without a decimal point our floats with decimal
points are boolean.
Which is true or false and then none is done.
Now to print these.
I want to introduce you to another type of print.
So we printed like this we used to can still do you know sample print.
Right.
So if we do that and come over to here and we run this we'll see we'll get our sample print.
Right.
However what happens if we want to include variable.
So if we want to produce this string what we can do is called string formatting.
So what you're gonna do is remember how I mentioned that in an array or in any sort of counting for
the
computer it's going everything starts with zero zero up everything starts with zero up when a computer
counts.
Now what's important here is we can do something called string substitution.
So now squarely Brooke quotes we can put zero right at the end.
We do not format with quotes again or brackets again.
And then we give it let's say sample string.
Right.
So what I want to show you here is that let's remove the print part here.
So we have our string.
We have a string here with some sort of identifier here.
So this is this is the replacement.
So zero is the first element here.
So if we added let's say sample
digit or a sample and now this would show up but this hasn't been defined yet.
So if we do one.
So you see zero is referencing to this and then one is referencing to this.
So if we print that we should see both of our variables so we can see here print and then it substitutes
the curly broke curly bracket 0 with our string up here and then curly at one with the next one which
is our sample end which is why we get 4 0 4 4 and we can do this for as many as we want.
So the next one maybe two and then three.
Right.
We come into here we'll do a sample float sample bool
sample and then sample.
So if we look at the 0 1 2 3 4 what we can see I cannot spell apparently
I can't spell today.
Sorry about that guys.
We can see that we needed one more because we have 0 1 2 3 4.
So go ahead run this.
We can see that we've got our string
our integer our float our boolean which can be printed and are not.
So it's important to understand that these are only some of the variables in the certain types of variables.
There are a few others.
And with Python a lot of different things are considered variables when they would be considered objects
in other languages.
So keep that in mind.
But these are going to be more than enough to get you going to what you need to do for the rest of the
course and then programming in general for what we're going to be doing here.