Hi guys.
Welcome back to another class of our course.
About the complete introduction to Python.
So in this class we are gonna talk principally about variables and the ways that we can store data in
our let's say programming when we are programming on Python All right.
So very basically there is two types of variable that exist.
Well there are more but the major ones will be well those three the first one is the tags that up.
So let's say we have text that we want to print.
This will be our first type of that.
In this case we call it string so a string simply a plain text that we are writing down.
So let's say for example we are printing printing hello world well hello world is a string the second
type of data will be that that can be used for calculations.
So let's say for example we want to calculate things well this type of data will be numbers.
So twenty five twenty thirty five.
Any type of numbers will be plain the plain that sorry will be numbers.
So this type of data is simply numbers.
So every every type of numbers is can be technically numbers data very important to understand also
that numbers could potentially be also string.
So in this case let's say for example you want to write down 20 you can write down 20 as a text or you
can write it down as a number.
The only difference is if you write down if you write it down as a text you won't be able to make calculations
with it because it's a text.
It's not a number.
So very important guys.
When you use those.
Well those those data for example if you use a number well very important to write it down as a number
if you want to make calculations.
If you don't want to make calculations with it simply write it down as a text.
Finally the last step of that will be the boolean data.
This type of data simply returns.
What works with the true and false when you have to use Twin Falls Well this is boolean data.
Once again it won't talk too much about it in this class since we're still talking about basics but
just for you guys to know that it exists.
I'll also show you an example.
Boolean data at the end of this course.
So just for you guys to see what it looks like and for you to understand a little bit to have a visual
of what it looks like.
All right.
So let's start.
So to be able to work with the variables what we want to do we'll write down a simple text for let's
say well we'll just write down a simple text and we'll change variables off in this text.
So 1 what we want to do right now we'll write down a text to someone to ask him about his car and his
house.
So let's say this person is named Mr. Jack.
So we'll say hello Mr. Jack
I am very interested by your car
is it red
also.
Mr. Jack is your house
older than 20 years.
Oh
thank you Mr. Jackson.
Thank you Mr. Jack.
All right.
So right now we have our very basic text once again that's just a very very basic text from here.
What we want to do is simply change let's say some words by variables that will y we'll do this is let's
say for example right now it's just four lines.
But let's say you have one hundred lines of text and you have words that you want to change at major
places.
Or for example you have e-mail.
So you have models of e-mails and you want to add names in those e-mails so let's say Hello Mr..
And you want to write down in name.
So you have templates of e-mails and you want to let's say change the name or change anything in this
template.
Well this is a way to do it.
So very simple.
What you want to do here is simply identify your variables so the first thing as I showed you the up
work so I'm able to generate my app right here.
So right now the next thing that I want to do is very simple is identify my variables.
So whatever variables I have here I have the name.
So person's name our first variable will be person name.
So we want to create our variables we are creating our variables right now.
So how we do this.
First of all we write the name of the variable we write down equal and we write down the name that we
want to create.
So in this case it's Mr. Jack.
So this is the name of our first variable so the person's name is Mr. Jack.
All right.
The first the next variable that we want to change will be car.
So object one in this case will we'll call it Object
and what is Object 1.
So in this case Object 1 is a string data called core.
So we have to string that is right here.
Next thing we want to change is the color.
So we'll call this the this variable object.
One color and in this case the color of the object one is red.
So as you can see what I'm doing right now I am naming my variable so I'm I have my variable and I named
my variable.
This is the data that I store in my variable.
So I have the variable and the data stored in.
All right.
Next thing we have our fourth variable which is house.
In this case we'll write down object
name to
so in this case what's the name of the say an object.
Well it's very simple.
It's house.
Next thing we're looking for is our in each of our let's say a house.
So it's 20 so object in this case the name will be object
to age equal.
In this case it's 20.
So I can write down 20 in two ways.
I can write it down just like this.
Since this type of variable is a number so I can leave it like this or I can write it as a string.
So in this case we'll write it as a string because I want to write down 20 years or so I'll write down
the complete verbal 20 years old presidency I have my fifth variable and then I can use it as a number
so for example I want to say also Mr. Jack is your house older than I can just change a 20.
But I want to change the 20 years old as well.
All right the less variable.
Well we don't have any variables anymore.
So that's it.
We have our five five variables what we want to do now is add those variables to our text right here
well to our small upright here since this is a map.
So if I run the app it will come back the same way because we didn't add those variables here.
All right.
So the first place where what we want to change will be the person's name.
In this case it's Mr. Jack.
So what I want to do was simply write down our text.
So our first birth which is Hello.
Then we add a plus and then we add a person's name so which is our first variable so hello first plus
first variable all right.
Second second sentence I am very interested by your SO in this case we'll use the second variable which
is correct so we'll add our plus right here.
So we divide our text right here.
Second part of text right here and add a plus object
one very important guys.
If you have kept the letters in your variable if you named your variable with a capital letter don't
write small letters.
And if in the other case you wrote small letters here don't write up the letters because it's not gonna
work is it plus.
So in this case we add that we add object one color
all right.
So we get the point next.
Also Mr. Jack in this case we have our variable.
So Mr. Jack plus
so plus person name
is your.
So in this case we are talking about the object name too which is the house.
So object name to
older then and in this case 20 years old.
So 10 years old will be our object to each so we'll just take this
as I can see I made a mistake in object I wrote object so it doesn't detect any variable so very important
we need to write down the exact same thing
as you have here
all right.
Amazing.
So now we have absolutely everything that we need.
The only place left will be here.
So it's gonna be.
Thank you and this case will we'll have our person name so person name.
Right.
So right now we have all our variables.
What what to do right now.
We'll simply write our function.
So as you can see our function is the exact same thing.
So.
Hello Mr. Jack.
Right now let's say instead of Mr. Jack we write Mr. Tom and we run our up.
So you can see we can see here.
Hello Mr. Tom.
I'm very interested by your car also Mr. Tom is your house older than 20 years or so as you can see
sometimes here we have words that are well close to each other how we can change this simply by adding
I think the clicking on the spacebar and that well you'll have no more problems.
So very simple simply click on the spacebar and it should have no problems with that.
All right.
So you understand the point for variables so let's say I want to change the 10 year old for 10 years
old.
It's gonna work the exact same way.
So here I have my answer which will be 10 years old.
Right.
Let's say I want to change house for I don't know duplex
as you can see here is going to be the object theme.
So hello.
Well also Mr. Jack is your duplex older than 20 years old so it's just perfect.
So right now we have Mr. Thompson in this case it's Mr. Thome.
As you can see here we have everything want.
So this is the way that we can store our viable so this will be our variables right here.
This will be the data that is stored in our variables.
What is cool.
Oh cool.
Also with python is let's say for example I have this text right here but right now I want to generate
another text right here.
I don't have to change desirable names so let's say for example I have my text right there.
I copy my text and I pass that right here.
So in this case let's say I generate my answer so I will have to text.
So hello Mr. Tom.
Let's say in our segment the text right here I want to change Mr. Tom for Mr. Andrew
as you can see in my second text it's gonna change but in my first text it's gonna stay the same.
So let's say my first text I want to go from Mr. Thumb to Mr. Jack so it's gonna stay the same thing
I can do this also with a 10 year old let's say here it's gonna be ten I want to I want it to be 20
years old.
So as you can see it will look something like this.
So I can have.
Well I can have the same names of variables but since I just change of places so for example I created
two texts one under the other my variables will adapt to Python will automatically adapt to let's say
my what I'm writing my program that I'm writing so I can change the name of my variables for example
here person name will be Mr. Jack and here this person's name will become mister and all right.
So this is for our first date.
Well for variables variables and data.
So as I explained this will be your variable you can name your variable and you can change it when you
want and if you want to change it you simply change the type of data that is here you have two types
of variables.
You have strings which are texts you have numbers which are numbers the words set it.
And as I showed you for example here we have 20 years old.
You can change your 20 years old by simply writing down 20 20 will be for example.
In this case your number.
And finally the last step of variables we have will be the boolean.
So we'll delete all this so boolean value is simply true or false that variables that have true or false
in them.
I'll show you a quick example of what it looks like.
So let's say for example having a house once again you don't have right now to not to understand but
just that you have to understand that it's simply true or false a false value.
So I'll just show you how it works.
I won't talk too much in details in it.
We'll talk later about it.
Let's say having
House equals let's say true so if once again right now I'm also writing down a function so it's just
to present to the boolean.
All right
I own a small house.
All right.
Here we go.
Perfect.
So because while my boolean my my boolean value which will be here true or false.
So if I read I read I right to right here.
This will be generated in the other case.
If I write I write false sorry.
This will not be generated.
So let me show you.
Let's say I'm here and I write down false well.
This will not be generated.
So as you can see there is no code generate.
There is no end search and read.
So we can understand boolean value is simply working with the true or false.
Once again this is just a quick example it's very very like let's say just explaining what it should
look like true or false.
In Python.
So it looks like this.
We won't talk too much about it right now.
But true or false is a huge part of Python.
And we'll see in our next guests.
That's it for this course.
Guys I hope.
But right now you know well until now I think you should know the types of variables that exist and
how you can implement variables in your programming.