Here in this video, we are going to discuss Biton keywords and identifiers.
So we're starting with the python keywords, so keywords at the of words in Python, like any other
programming languages, Python has got multiple different keywords.
So during coding, key words can be used as a variable name and function name or any other identified
that this keywords are reserved for the keyword purposes only.
They cannot be used as a variable name or identifier or function, name, model and so on.
So that's why these keywords are reserved for them.
So they are they are used to define the syntax and the structure of the python language.
So in our python drill, we'll be using almost all keywords in different sections has when required.
So keywords are darkest, sensitive in Python.
So at least this is this is the list of different keywords available, and you can find that here.
We're having 33 keywords.
So one, two, three, four, five columns there.
And one, two, three, four, five, six, seven are there.
So here we are having 33 keywords.
And all the keywords will be discussed in the next videos has been required because they without them,
we cannot write our code.
Let us discuss Biton identifiers, so Python identifiers is nothing but the names given to the entities
like your class functions, variables, etc, so that's where they will be known as the identifiers
and they will be used to name a class to name available to name a function in Python.
It helps us in differentiating one entity from another entity.
So that's why all the function names should be distinct, all the variable names should be distinct.
So rules for writing identifiers so identifiers can be a combination of letters in the lowercase or
in the uppercase letters that is capital A to capital Z at digits ranging from zero to nine or an underscore
like this one.
So these are the valid characters in our identifiers.
Names like the MIT Class one, underscore two and display underscore two on the screen.
So these are all the valid examples of these identifiers.
So I did the Fergana start with the digit.
So one variable is not valid.
It is invalid, but variable one can be treated as a valid identifier.
Key words cannot be used as identifiers, we cannot use special symbols like exclamation at the rate
of hash, percentage symbols, etc. in our identifier name.
So these rules are mostly common in almost all programming languages.
But in Python, these are the rules to be followed while defining identifiers.
So let us go for some demonstration for the better understanding.
Britain is having multiple different keywords here in this demonstration, we shall discuss some of
them.
The first we are going to discuss that is true and false.
Remember, too, is starting with the capital city and rest of the leaders will be in the lower case
and in case of also the same uppercase and lowercase syntax will be maintained.
So here we are having five equal to equal to five and five.
Good.
And then you can find that we are getting the outcome as true and false.
So here the true and false are nothing.
But the key words in Britain are going to have the next one that is of a none so nonphysical.
Now let me go for the outcome.
So it is producing the output is true.
That is Nonis, not Giteau Nonis Nautical the false Nonis not like an empty list and nonphysical is
going on.
It is returning me that to know what is the use of non actually.
So let me go for this here too.
I do find one function.
The name of the function is a void function because it is void, right.
Because it does not return any value.
So now if we the return, if we assign to X and if we then print X then obviously we shall get the non
as the outcome.
You can find that we are getting none but here if the function returns.
They find that it is returning the value see value of these three hit and three is getting printed.
But if we just make this line on it, if we just omit this line, you are getting the outcome as not
because the function returns none.
Next one is the end or and not so true and true, true and true outcome will be true and true outcome
will be true and false.
That outcome will be false, true or false.
The outcome will be true and not a false outcome will be true here.
So in this way, you can go for other combinations.
So let me write some other combinations here.
So let us suppose I'm going for true and true.
I'm going for a true false.
So here we're having this true or true, and if you go for the truth here.
So let me check, what is the outcome we are going to get so true and true is true, true or true is
true and not true is false here.
So there is another way to get the outcome.
And here to discuss that is the and or and not keywords.
Now, we are going to have this as so important, Matt, as my Matt.
So here we are having this ileus of this model, Matt.
So here the key word, as has been used and in the rest of the code will be using my Matt, not the
math here, because Matt has got this model has got renamed to my Matt in this application.
So my metadata calls my metadata by in this way, you can go for the output.
Next one is Assad after Assad using the right one booleans statement, so five, Géraldine five, it
is producing assassinator.
So that's why it had some Assad is taking place.
But if you're right, fibular danford so often Assad, those who write you should write some exhibition
who will return some boolean output.
That is a too.
And also some condition has to be written after Assad.
After Assad.
So now you can find that no outcome is option because both the conditions are true here.
Next, we are going for the break, next QAD break.
So in this break, what is happening?
You can find that for I in range one 11.
So that means I will have value ranging from one to 10 because this one there is a lower limit will
be inclusive and the upper limit will be always exclusive.
So that's why we are having this.
I will be ranging from one to 10 actually if you use range one comma 11.
So if I is is going to fight, then break.
That means it will come out from the loop.
That means it will dominate the loop and it will come out from the loop.
So what will happen?
So the outcome is sprint.
So I will be printed for one, two, three and four.
But here when the eye is equal to fight, then Brigstock will be executed.
So print right will remain unreachable, will remain unreasoned and execute it.
So as a result of that, up to one, two, three, four, it will get printed.
So Brick will actually dominate the loop and it will come out from the loop here next.
Next, we're going to continue in because I want to know you can find that for I in range one, comma
eight, that means I will be ranging from one to seven.
So if I is equal to five, so when the value of I will be five, then continue that with the next part
will remain on executed unbreachable and continue to continue with the loop with the next value up.
So what will happen.
One, two, three, four will get printed for five to continue will take place or the content will be
going back to the fourth statement again.
So next time six and seven will get printed.
So five will be missing in the next.
We are going for the class.
So let us suppose here we are having one class that is the example Class A class will B containing multiple
variables and multiple member variables and member functions, also known as messages and methods respectively.
Here we defined two methods.
There is a function, one parameters.
We shall be passing parameters and then print function, one that is executing their function to parameters
of brain function.
Two is executing.
So now we are creating one object under this class that is an example.
So here is a key word to define a class.
And here the object has been defined under the class example class it.
So it will be one but function one and it will be two.
That function two will be called here.
So now if I go for the execution, I can find that function, one executing function to executing their
getting printed.
So in this way the class can be defined using the keyword class.
In this way, the class declaration will take this next year, having this deaf, so deaf will be deaf,
stands for defined, so deaf will be used whenever we're going to define one.
It was a different function, so deaf then functioning will be coming, then parameters and then, let
us suppose, are having these past passes nothing but one placeholder.
So if we execute past then actually I know outcome will be opting for Puddleby.
Our boss is actually required in those cases where we are supposed to enter or include some more codes
to add some more functionality to the application.
So that is the use of the pass actually.
So DEF is a key word with the help which were defining one function, and then you can call the function
as well.
So now you can see this particular function we are calling.
So that is one argument.
It is decoding.
There is a parameter.
So now let me go for the parameters here.
So I'm passing setin here so there will be no error, but obviously there will be no outcome because
past does not produce any output here.
Next, we are going for the delay.
So this particular deal you see a is 210 print.
So the value of it has got printed as then delayed.
That means this aid is variable will get deleted from the computer's memory.
So next time if I go for printing this E, then one error will be raised and that error is known as
nimura because the variable does not exist and is written as the message.
That name is not defined here because after deleting the variable, A will be allocated from the memory.
So next time if we go for print, it will tell you it will raise the name error here.
We're having this, if live and else nonmusical do, too, if nothing is done, then print one ayliffe
elopements actually elusive but here in case a python will be writing it as ayliffe, if I've always
remembered after event after Ayliffe will be writing one condition.
This a condition where writing after the condition that it be one colon, this conolan indicate that
we are starting with the block and that this true part of this if statement.
So under this true part where we have kept only one statement, that is a print one.
So it is having one indentation.
Indentation means for blank spaces, you can find that we are having four blank spaces here.
So that will indicate that this line is having the first statement with the indentation and then will
be writing this elif with the outer dent without.
Then you can find that the same indentation will be maintained for even Elif they'll be starting from
the same column and now is difficult to do it logical that the value of NUM is equal to two or not then
one colon so nobody will give colon and presented automatically.
The castle will be blinking with the new indent.
So there is a print and ls it having something else.
So this is the if Elif and L's block anyone else, they are optional.
If it's mandatory, if we write any conditional block so elif can occur for multiple number of times.
Also we can have multiple elif so let me go for the execution.
You can find that it is printing too.
If I make it one it is printing one.
If I make it three, it is printing.
Something else, because because nonmusical is a good one, is not getting through, nonmusical is to
do is not getting through.
So it is coming to the spot.
Now, let us suppose I am putting.
US, suppose I'm putting another check that means out of the ayliffe.
So now in this way, what will happen, it is printing three, but if I make this one four, then it
will be going for the eighth spot.
So I think now you are getting this idea of what is ayliffe and else block next week going for this
dry race catch.
And finally, so these are the very important keywords that under the try will be writing so many statements
we can try to block what we are expecting.
Some errors may be erased, so errors may be raised during the calculations or competitions.
Others we can also raise our error if adequate, to do so.
He had one error we have raised that is a jiru deviation error.
So after this, except this division error has been mentioned.
So you are going to handle the erroneous condition here.
So then these are these are respective remedial body.
And then finally, is that the portion that is that there is a block under the finally will be executed,
even if the initiator is orcharding or if there is no error, then also the final block will get executed.
So let me go for the execution so division can be cannot be performed because they to hear the res digital
division, it has been raised here.
So but you see the final block is getting executed execution successfully.
So now if we make this one under comment, if we make this one under comment, then I can find that
the execution successfully, this particular statement is getting executed.
That means the final block will get the control always, irrespective of the fact that any error has
been raised or not, will be discussing all these aspects in our respective chapters.
For more detail, let us go four to four.
So these are the key words.
So for I in range one, comma ten.
So here this is valuable.
I will be ranging from one to nine.
As I told you that the ending limits, the stop will be exclusive.
So here's the follow up.
I will be ranging from one to nine, as you didn't mention any stipple also by default will be one.
So that's why this value will be increased by one by one.
So one comma then that means one comma, two or three up to develop.
I'll be ranging up to nine.
So let me go for the print.
You can find that in this way.
The fourth is getting executed using this far.
We can go for the iterations and looping next.
We are going for this from an import, another two very important pair of key words.
So import math, that means we're importing one module.
The name of the module is Esmat and from Matt we are importing this costs so little.
We can use this cause as when required.
But there in that case, we need not to apply.
So I'm just writing this one for this print.
Go for cause.
Say I'm going for the ten here.
So if you're going printing, you can find that it is printing a value.
So here I need not to write metadata cause I need not write because we have written from math import
cause here so I can use this course method according to the syntax as I have shown next, we are having
the next key word.
There is a global.
So here they will define one variable that is a global FA.
These are read one which will print the value of this global war.
There's a right one here.
You are mentioning the global word as a variable with the key word global.
So now this global word is getting updated.
Now using the right tool, we can also changing this global world with fifteen.
But here you can find that this global global for this particular statement is missing.
So this now what's going to happen?
So let me go for the execution.
See, at first we call this ridwan one function, so ridwan will bring the global value and that is
so ten has got printed.
Now it is called the right one function.
So write one function will define this global for as a variable here within this right.
And this global keyword is actually indicating that this global terrorism is not a new variable, but
the same variable which is there as a global variable.
So we are doing the bit on to that.
So next one is a read, one function is getting executed.
So when you are presenting this global effort, we are not getting the but we are getting this updated
value.
That is five here in case of now we are calling this right to increase our right to see the global global
what that statement is missing.
We are writing this global war 15.
So what is happening?
This global effort is might be having the same name as that of the global variable, but as we didn't
write global global war here.
So that's why this global war is working as a local variable within the right to method.
So now what about the other were doing that?
Their scope is confined within this right to method, so it is global for when it will get printed.
I'm going to print the five again, not in here because we are going for the read one at the last.
So in this way you can see that in this code how the global keyword has been used.
We're having this in so in actually use for the membership, so here to find one list, the list will
be included within the square brackets in our in our Biton.
So four in a so now it is checking with the four is is a member of this list or not.
It is producing double true.
But if you like the same say print say 44 in a then obviously it will produce outcome as false.
So that is a what in.
And also we can go for the norten.
You can also go for the Norten.
You can find that.
So for not being a is false and 44 not being a is true.
Next one you are going for, this is so not true, is true, so easy secured, so its outcome is true
here to define anonymous functions that is used at different functions, but no name without any name,
whether using the key word lambda.
Whenever we define a user defined function with the name we are using the key word def stands for DEFINE.
But in case of anonymous function, anonymous method, the keyword will be lambda.
So here you see lambda.
So the function has got no name.
It will take this X as input document and it returns it to it.
Does the calculation that is X start to that is two times it will multiply this value of X and that
will be assigned to it.
So for I in range one, comma six.
So that means I will be ranging from one to five and it is printing i e i that means this I will be
passed.
That means at first the value of I will be one, then two, then three, then four, then five.
And this will be passed to this method and he is returning that to into X.
So to do I will be returned.
So I'm going to get instead of one, I shall be getting two when the value of I will be two I shall
be getting four and the value of I will be five, I shall be getting ten here so I can also print develop
I for the better understanding.
Next, we are going for the nonlocal.
So these outer function we're having, this variable A is to fight is the inner function here to have
defined this one as nonlocal A..
And now we're just updating the value of eight and from the inner function, we are printing the value
of eight from the outer function.
Inner function has been defined.
So now we can call the inner function and then from the outer function scope, we are printing the outer
function eight.
So now we're calling this outer function, using this statement so we can find that inner function has
got assigned ten to A because he is nonlocal eight.
That means this is nonlocal.
That means that there is not local within this inner function that is using this eight.
And whenever we are doing some uprate and whenever you are printing this one, I'm getting here 10 and
from the outer function.
And so if you print this, I shall be getting 10 back here.
So here you are discussing the keyword.
That is a nonlocal we're having the key word.
There is a pass which which I've discussed already.
So past will have no outcome.
You can see that I run that code, but no outcome has been obtained because this is actually working
as a placeholder.
So in future, under this function function, if I want to add more functionalities, if I want to add
more codes and statements, in that case, I can do this pass because it passes nothing but one placeholder
letter for new code insertion.
I can replace parts with the new set of goals.
So that's why you see it is producing no outcome.
So let me call the function also.
Surpassing the extent you see it is producing no outcome here.
Next, we're having this return returnee's, another very important quote.
So is the gluten within dysfunction, the body's azy gluten and return it.
So now whenever we are calling this function the function to return the value of that esten and we are
printing that value here.
So now let me go for the execution.
I'm getting down here.
So now we are having this while so indicates a while I is equal to five, I get a 10 zero print I and
II is equal to a minus one.
So I've written this one as a minus equal to one so valuable.
I'll go on printing and this process will be continued when the value of I'll be greater than zero.
So if I execute my code I'll be getting the output for Israel.
Two, five, four, three, two and one.
OK, the next keyword is with so with open example, the text W as my file.
So now what will happen.
This example will be opened in the right mode and here we are using the key word width and to that particular
file pointer.
Did this particular file reference.
We are calling this right method and this particular string will get printed onto the example.
So now if I go for the execution, you can find that the example, the text there.
So let me go for the jocking example.
The text has been created just a seconds ago and you can find that its body is having only one string.
That is a HelloWallet which you printed here, which you printed here.
So in this way, we using this with keyword, we can open a file either in the remote or in the right
mode or in the open mode.
And we are having a separate section where we have discussed that what are the different modes are possible
and operations are possible on our data files.
So this is the use of that with keyword we're having the field.
That is another very important key in our generator.
So therefore generated.
We have defined one method.
The name of the method is generated and for I in range six, that means he had this value up.
I will be ranging from zero to five.
Six means the value will be ranging from zero to five.
And here we are not returning anything except in case of generate a function.
We do not have the return statement we usually have the instatement yield will go on accumulating all
the calculated values.
So what is the value here?
I start I, I will be ranging from zero to five, so I'm going for the square of that.
I so it will be having the value zero one four nine six and five squared.
That is twenty five.
So now it will return one iterator.
So now the outcome will be will be operating in G and then from four I n g I shall go on printing the
value of Pi and the respective outcome will be operand here.
So instead of having that return in case of Ginetta functions will be having the key word ILD, which
will go on accumulating all the calculated values.
And later from this iterator we can using the for loop, we can pick up each and every element at the
time in one loop, in one iteration and go on doing the competitions.
But here we have just put the value of EI here.
So in this particular example, we have discussed multiple different keywords.
You can see that so many different keywords we have defined other than these are the key words are also
available.
But these are the most usable and frequently used keywords in our python code.
And on them we have written small example calls and we have explained that one with the required outputs.
Thanks for watching this video.