Hello and welcome to this video.
In this video we are going to be creating some variables creating variables in Python is really straightforward
or you need to do is give the variable in name and then you assign some values for the variable to store.
I'm going to be using my command prompt to create some variables so I'll be accessing the python interactive
shell so to do that I just type in Python and press enter.
If you are on a Mac you need to go to your terminal and type in Python 3 so the first thing you need
to do when creating a variable is to give the variable a name.
So give it a name that is descriptive that reflects what type of data of value that the variable stores.
So let's say I create a variable H and you use equals 2 to assign a value.
So say I give it an h of for a presenter and that's a variable created.
If I want to access that variable the value inside that variable all I need to do is call a variable
by its name and press enter and it will return the value.
You can also change the value that the variable holds.
For example I can come here and say H equals to fight and presenter.
Now if I call that variable a it will no longer store for.
It will not store five because the value has changed so that the value that a variable stores can vary.
So let's say I create another variable and I give it a value of say blue line.
Now if I want to reference name I just say name and it will give me the tex blue line.
If you notice there are quotes around it.
If you don't want the quotes you can go to print.
I can just say print name by wrapping the variable inside the print function to print out the value
without the quote.
So let's create a few more or create another one called City and I give it the value of say London I
will create or another variable.
So create one called green team and inside this I can store a long piece of string or text so you can
always store what you like inside your variable value so say hello world and do that.
So I'll say hello world and say thank you.
So variables are quite useful so for example any time I want to see something like this I don't need
to keep typing it out each time I just call the variable by its name.
For example I can say print inside the print function I just pass in the name of my variable which is
great team and it will just spit out the value you can see here is just printed out the value of that
variable.
So variables are quite useful because you can store a lot inside them and that saves you typing things
all over and over again.
So if you have values that you want to use or reference often within your application you can store
those values inside variables and then just change it as you go along.
You can also construct a sentence or statement using variables for example I could see print in some
print function I could construct a simple sentence I could reference a name which is in name of I've
got a variable code name with a value Blue Line psycho's a name and a comma and then the quote I'll
say is from
our end quote and a comma now city.
Now the name and the city are both variables.
So I've got a name here with a valid blue line.
I've gotten a variable here called City with the value of London.
So what I'm saying here I want this print function to print out the name which is blue line and then
add this piece of text and then add this variable name.
So if I press enter you can see is constructor something same blue line is from London.
So you can see the power of variables.
You can store any data time.
You can store numeric related values and you can store string or text reflected values.
Also variable names can change.
So you can create a mean variable values can change.
You can create a variable and then later on reassign the values that the variable holds.
So that's set for creating variables.
Thanks for watching.
Bye for now.