In this lecture we see how to create the variables in the python.
So first to follow up on your cell and give the variable name.
So let me say my name is my very evil name and let me say I want to give the name such in which is my
name.
Inside this double court so you can see inside this double court.
We have passed something text inside here.
That means this is a string like in many languages.
It may be in the CSR or Java.
We don't pass here semicolon 2 in the statement.
In the case of Python it will simply pass nothing over here.
In order to see the output or basically the content of that variable you simply give the name and it
will source the content.
If you want to give or make or integer variable let me say I want to make the matter variable which
will contain it.
And if I want to see the content of a mad variable simply pass the name is a math and you'll see the
content is it.
If you want to give the math variable at the same variable but with the different value at point nine
then it would be tens directly to eight point nine.
So this is the dynamic programming in the python.
That means we can assign any value in the python and it will be valid which is not in the case of Tsavo
or any other high level languages and fight being or dynamic type language.
It will be just as valid in the python so you can make different variable over here so you can make
a boolean type.
So let me say an honest variable and if I say to you.
So make sure that these capital over here because we have seen in the case of a keywords.
So this is basically a keyboards and cures are case sensitive.
So that means this deal has to be capital.
If we make something like you see this ought to be valid.
And if you make something like live music and honest is t r Dewey this is the boolean type.
If you want to see the class or what is this type of honest and it will as a bull which means this is
a boolean if you want to see this type of the Met which is obviously the float and if I say math type
it is so so flawed so float is basically a decimal which is basically you can see the content of the
mantle here which is eight point nine which is the decimal.
So Plaut is for the decimal if you want to see the type of the name you will see it also as a string.
So if I say type of the name it will give us a class as a string.
So type is and not the funds so not a matter that is going to source our data type.
So we have now studied about this string which is inside this double chord.
Anything that is inside this double chord is a string.
If you type something like let me say Hey I am then this is also a string so anything that is inside
this double chord or it can be also the single chord.
Hey.
Hello.
Everything that is inside this single code our double chords every string and other is numbers number
so anything that is a five or six or any number so that is your number.
And next thing is the your basically this Boolean Boolean would be true or false.
So you can see we have seen our buns of fundamental archetypes over here.
So let me say this first.
So we have a bunch of fundamental narratives so we have seen over the integer string and boolean in
dyslexia we have to explore further that doctors in the upcoming lecture but for now you can see we
can also do multiple assignments to the variable.
So we have seen how to create the variable it ought to be something like starting with the VOD or starting
with integer or starting with string.
It ought to be in the case of the python in order to create the variable in Python.
It is really easy.
You have to simply give the name of the variable and let me say I want to create the integer variable.
Having the health of the character to be 90.
So this is your variable.
So if you want to take the held the content of the health you simply pass the name and you will see
the content is 90.
So this is the way to create the python variable if you want the multiple assignment to the variable
that means if you want to create variable a b and c if you want to create a variable A B or C so to
hear every and C and if you want to have the multiple assignment to this variable instead of this creating
one you can just parse here something like 5 saving or if you want to the sparse string here saying
hey then you can do this.
And now if you want to this take the value a b c you can see it is 5 7 and hey if you want to see a
variable it is 5 b is 7 and if you c c it would contain him.
So this is a multiple assignment to the variable are basically the multiple variable.
So we have a ruler naming convention to create the variable in the constants in all programming language
and that is the camel case.
So if you want to create the variable name makes you it makes sense because if you want to give the
player character name and if you just create the variable.
And if you say the player name this.
So this doesn't make any sense.
If you just C is so it would make sense for you but if you see that other programmer are using the same
code of yours the third thing that this variable e represents the player will play a name.
So make sure that every variable makes a sense.
So if you say that name like this are name of player and give the player name.
This will make really sense so anyone will see your code.
Will this thing like Okay this is the name of a player and that will get the more sense to the other
quarter to or maybe for yourselves too if it is this go to the chord back after long time.
So next one is to use the camel keys so camel case is really important in addition to declare the variable
and it starts with the lowercase.
So if you want to say clear the name with the my is so I'll say tonight 9 and if I just sprain my ears
then it is saying it in anyway.
So this is your camel case that starts with the small r lowercase and after no basically one similar
letter uses make with a capital letter so as to specify these other two words so it fuses into it.
Let me say my and address.
So after this one word you start with the uppercase for the first letter and you go with all the lowercase
and use this give your address.
So this is the way our convention which will make commodes more sense so basically will be more attractive
when you just make your variable name.
So next thing is to just use the capital letter whenever possible to declare a constant.
So if you want to create the by variable which will be three point one four it should be all in uppercase.
This is the way to clear the constant so you can also see the gravity.
If you see these gravity nine point eight this is your constant which is in the uppercase all in uppercase
and neighbor make use of a special symbol.
In the case of making the variable.
So making like my has is.
And 90.
This is not valid.
This is not valid in the case of Python.
Never make use of this fiscal symbol while creating the variable so SPSS symbol can be like this exclamation
mark at that a sine has a sine are basically the dollar sign.
All of these special characters are not valid are the person it is module assigned.
This won't be valid in the case of the python because all of these had the special meaning in Python
so this modulo is for the division and these a dollar sign and this has for the comment.
This all have these special meanings so you can't make use of these in the variable name.
So next thing is that you do not have to start your variable with the DC.
So if I said 9 my name and if I say hey this is not valid because you can't have the variable that is
started with the D it next one is that we have to put the constants in the separate module and we'll
learn about that in the upcoming letter.
But for now just remember for the constants it better is to make a simple python file where you can
have all of the constant is sorted in that file and it will make use of that file is a constant file
and will import and use in the different file so these other type of four are basics.
And the naming convention that we have to follow while creating the variable name and that is to make
much more sense while the variable in working with the logic in the upcoming lecture but for now we'll
see about the type conversion.
So I'll just open this demo file and are basically will this go with the sale and I'll show you here.
Let me clear this first.
Let me this close out and open the new terminal or a new cell.
And now here all you need to do is first of all let me say input command.
So input is going to input you something.
So I'll see into your is so I'll set this into your rates and let me say that it should be inserted
in the variable name is.
I've created the variable.
And with this input command.
So same as print command.
This input command is going to input because this is also a method that is going to input so print is
basically consoling out and print input is basically inputting audio commands are basically what do
the spots here.
So if I say interior it is and if I say fifty six is my is and if I eat into and if I say this is you
could see that we have endured here that is integer but it has deflected out is a string.
So I have a difficulty in that before Lake so that anything is inside this double quote is a string.
And if we see that is this 56 is the integer.
So if I say type which is the method to take that if I say 56 then it will get you a string which is
a string so if I said type only 56.
Now it also has a string of basically integer because this is integer but if it does input here that
is 56 that is.
That was in TiSA which was in 40 days in TiSA has been converted into this string which is done by this
input method.
So now all you need to do is type conversion are typecast.
This in desert to r string to the integer.
Because we want 56 not as a string but integer.
So in order to do that we have a couple of method for the type conversion.
If I say is and now you can see that this is which was in d o which was this string has passed into
this into method to be converted from a string to the ante terrified into.
Now this is who saw this string has been converted to the integer.
If you want that back that is MySQL I will say is in TiSA and is so let's go back.
And now if I say it is is now in TiSA but if you want to roll back to the string now again you can do
something like Is USTR which is another method to convert integer to this string or anything other to
the string.
So if I say inter again and see days it has been now typecast it to those string again which was in
TiSA before has been type converted our type cluster to this string.
So these other type convergent method which is done implicitly over here which is converting integer
to this string string to the integer we can also do boolean to string in the same manner.
And this is the way to the spa from some of the operations in the next leg so we'll see output formatting
and we'll see how format method can be used in the next Lexus see the next one.