Python variables and constraints, we shall start with our discussion with Python variables.
We know that in any programming language we define some variables.
So variables are nothing but some named memory locations.
So how many memory locations will be defined under one variable that will be decided by its dictate?
That is a side of that data.
So here we are having the python variables.
So in Python Biddable is a name name.
The location used to store data in the memory.
Each variable must have a unique name called identified.
So depending upon the data type of the variable, the number of bytes going to be occupied, that will
be decided and the memory address of that memory block will be having a name which is accessible from
the programming code.
So that will make the programmers it will make the programmers easier to write their goals in Python.
Variables do not need declension to resolve memory space.
The variable declension or the variable initialization happens automatically when we assign available
assign a value to a variable.
So there is no need to define all the variables at the beginning of the code, like in our C C++, we
always write all the variables and the respective negatives at the beginning of our code and then only
we can use them in the respective successive codes.
But that constraint is not there in Python.
That variable declaration and the variable initialization can be done in the same statement.
So here you see this account is equal to one hundred.
The underscore name is Robyn and say H1, H2 is three is equal to 44, comma 37, comma 22.
So in this way, you see at this particular line, the variable age one is two, three, they are defined.
Their respective vegetables have got initialised and here you see here we put the integer value so the
we will have their respective little type integer in that case.
So in this way, we can have multiple variables, can be initialized, can be can be declared in the
same statement.
And there is a syntax in which we are right.
So there is no need to put the semicolon at the end of the Python statement.
So that's why no semicolon is there.
So that's why this is a way to define and also to initialize variables.
He constantly is a type of vegetable whose value cannot be changed, and it is helpful to think of Constance
as containers that hold information which cannot be changed later on.
So that's why the constant is not but available, which will be holding a value.
But the value cannot be changed later on.
So naming conventions for variables and constants in Biocon.
So that is that nomenclature should be purposeful.
We all know that it is a good program aspect is the best practices of the developers and programmers.
Is that the variable name, the function name, the class name should be purposeful hamdard very variable
name.
I should get the idea what is the purpose of the variable and what kind of value it is supposed to hold
that use name.
There is a camel case notation.
What is the meaning of this since the first letter will be in the lowercase.
But the next two words.
If there are multiple words in the variable name, they'll be starting with the capital letters and
the rest of the letters will be in the lowercase.
So use capital letters to the present are constant symbols like you're at the root of hash.
Exclamation dollard percentage should not be used.
Don't start with the digit that is very common in the previous video.
Also, we are showing you that one one variable is not a valid variable name, but variable one is a
valid variable name.
So constants are put into function models and meant to be meant not to be changed to I.
As I discussed earlier, though, constants cannot be changed later on.
So constant and variable names should have the combination of letters in lowercase that is small a too
small Z or uppercase letters that is a capital A to capital Z are digits that is to nine or an underscore.
These are the valid characters in naming.
So let us go for further discussion with some demonstration for easier understanding in decision.
We are discussing and demonstrating how to define constants and variables so constants in Python can
be defined.
It is a common practice to write all the constraint, the constant name, all in the capital letters.
So physical two three point four gravity is equal to nine point eight.
In this way, the constants can be defined in our python.
And now we are going to define that.
How that variables can be defined and how to declare variable, how to assign valid values on them so
is equal to Apple.
So now it is available as the apple is up to type text or string.
So it be up to type string here.
So print a so I'll get printed.
So now let's go for the execution.
This line has got no print, so.
That's right.
No, no outcome is there.
So let me go for that print.
If you go for the sprint by we're getting this one and been one for now for this part.
If I go for the execution, it will come like this.
So is the apple so pretty, so it is printing Apple here, changing the value of available so that can
be done using reassignment.
So easy go to Aeroplan.
So now if you type this one and then print it, it is printing their respective string.
So next time I'm printing, I'm just assigning 100 to it.
So now if we print it, then it is getting the value 100.
So you're going to find that the same biddable sometimes may be initialized with the string, sometimes
with the integer, and that is allowed in Python because in case of Python, Python, Python is a dynamic
type language that means the variables will be decided during the runtime.
So during the runtime, whatever the value the variable is containing, that will decide the fate of
them.
And in case of Python, there is no need to declare the variable separately.
At the beginning of the code, we can define variable as when we request to use them and he can find
that here.
This is Aeroplane's.
So that means that EA has got the data type string and the next part of the code that will be treated
as a string until unless it is getting initialized with some other data type.
So here we ablated is equal to 100.
So the next part of the code will be treated as the type integer until unless is getting initialized
with some other type of Pelosse assigning multiple values to be available.
So B, C, D, all these three variables are getting assigned with this one, 2.5 Penhallow respectively
in a single single line.
So this one will be assigned to be 2.5, will be assigned to C and will be assigned to.
So when you are printing B, C and D, we're getting the outcome as one two point five.
And hello.
Next one, is that assigning the same value to multiple variables, using a same statement in the same
line, you know, so B is able to see is the D is equal to fight.
That was if I was getting assigned to B, C and D, but at the same time in a single segment, single
assignment STATMAN.
So Phi Phi Phi is going to get printed here.
So in this example and demonstration, we have discussed that how to define constants and how to define
variables and how to assign values on them.
Thanks for watching this video.