Here in this video, we are going to discuss Biton keywords and identifiers.
So first, we're starting with the python keywords.
So keywords are the reserve words in Python.
Like any of the programming languages, Python has got multiple different keywords.
So during coding, your words can be used as a variable name and function name or any other identified.
That means keywords are reso for the keyword purpose only they cannot be used as a variable name or
say identifier or a function name, model, limb and so on.
So that's why this keywords are designed for them.
So these are they are used to define the syntax and the structure of the python language.
So innervate Python tutorial will be using almost all keywords in different sections has when required.
So keywords are the sensitive in Python.
So at least this is this is the least of different keywords available, and you can find that here to
her having 33 keywords.
So one, two, three, four, five columns a day.
And one, two, three, four, five, six, seven rule rules out there.
So here we are having 33 keywords.
And all these keywords will be discussed in the next videos.
Has Wendy quit because they without them, we cannot write a word called.
Let us discuss Bryton identifiers, so Biton.
I didn't furze is nothing but the names given to the entities like your class functions, variables,
etc.
So that's why they will be known as identifiers and they'll be used to name a class to name a variable,
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 I did.
The first can be a combination of letters in the Lorqess or in the upper class letters that is capital
eight to capital Z are digits ranging from zero to nine or an underscore.
Like this one.
So these are the valid characters in our identifiers.
Names like the My Class one but underscore two and display underscore two under source code screen.
So these are all the valid examples of these identifiers.
So I did the first kind of start with the digit.
So one variable is not valid.
It is invalid by the variable.
The one can be treated as a valid identified.
Key words cannot be used as I did the facts.
We cannot use special symbols like good exclamation at the rate of hash, dollar or sentence symbols,
etc. in about 18 different names.
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.
Biton is having multiple different keywords here in this demonstration.
We shall discuss some of them.
The Foskey, what we're going to discuss that is true and false.
Remember, too, is starting with the capital letter D, and rest of the letters will be in the Lorqess.
And in case of false, also the same apartness, a look as syntax will be maintained.
So here we are having a five equal to equal to five and five.
Get it done.
Five.
You can find that we're getting the outcome as true and false.
So here the two unfolds are nothing but the keywords in Python.
They're going to have the next one.
That is of a none.
So none.
Izabel Izabel ejido.
Now, let me go for the outcome.
So it is producing.
The output is true.
That is none is not due to non is not equal to false noni's.
Not like an empty list and nonphysical izabela non.
It is returning me to know what is the use of non actually.
So let me go for this.
How do I define one function?
The name of the function is a void function because it is white.
Why?
Because it does not return any value.
So now if we 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've been find that it is returning the value see value upsy as they go to 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 there and ah, and not so true and true, true and true outcome will be two and two outcome
will be true and false.
The outcome will be false.
True or false, the outcome will be true and not 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.
And when four of true false.
So here we are having this true or true.
And if you go for that to here.
So, no, 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 that is another way to get the outcome.
And here to discuss that is the end are and not keywords.
Now we are going to have this as so import Matt as my Matt.
So here we are having this alias of this model, Matt.
So here had the key word as has been used and in the rest of the code he'll be using my Matt.
Not the matter because Matt has got this model has got renamed to my Matt in this application.
So my method accosts my method metadata by in this way you can go for the output.
Next one is the SRT after S02 using the right one boolean statement.
So five geddit, then five.
It is producing assertion error.
So that's why it had some S.R. data is taking place.
But if.
Right.
Five get it done for.
So after I say to all those who write, you should write some expression which in return some boolean
output.
That is a true and false.
So some condition has to be written after this aside, after that search.
So now you can find that no outcome is and because both the conditions are true here.
Next, we are going for the break.
Next queue, what is break.
So in this break, what is happening?
You can find that for I in range one, comma eleven.
So that means I will have their value ranging from one to ten because this one that is a lower limit
will be inclusive and the upper limit will be all is exclusive.
So that's why you are having this.
I should be ranging from one to ten actually.
If you use the range one comma eleven safe icicle divisible to five.
Then break.
That means it will come out from the loop tendency to dominate the loop and it will come on from the
loop.
So how did it happen?
So the alchemy of spring die.
So I will be printed for one, two, three and four.
But here on the icicle to fight.
Then break statement will be executed.
So print.
I will remain unreachable.
Will remain unrestrained on execute it.
So as it is, I wrap that up to one, two, three, four will get printed.
So break will actually dominate the loop and it will come out from the loop here.
Next.
Next we're going to continue in because up until we can find that for I in range one comma eight.
That means I will be ranging from one to seven.
So if I physical.
Physical of five, so on, when the value of I will be five then continue.
That means the next part will remain unexpected, unreachable and continue means to continue with the
loop, with the next value up I.
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 straight and again.
So next time six and seven will get brain dead.
So five will be missing in the output.
Next we are going for the class.
So let us suppose here we are having one class that is the example Class A class and B containing multiple
variables and multiple member vegetables and member functions, also known as messages and methods respectively.
Here you have defined two methods.
There is a day function.
One parameters.
We shall be passing parameters and then print function, one that is executing def function two parameters.
So print function two is executing.
So now we are creating one object under this class.
That is an example.
So here Claus's a keyword to define a class.
And here the object has been defined under the class.
Example class here.
So we'll be one dark function one and only two drug function.
Two will be called here.
So now if I go for the execution I can find that function.
One executing function to executing.
They're getting printed.
So in this way the class can be different, defined using the keyword class.
In this way, the class declares, and we take this next only we're having this deaf, so deaf will
be used.
Deaf stands for define so deaf will be used by anybody.
We're going to define one.
It was a different function.
So deaf then functioning will becoming then parameters.
And then let us suppose we're having this pass passes nothing but one placeholder.
So if we execute pass then actually no outcome will be opting out but will be obtained.
Boss is actually required in those cases where you were supposed to intern or include some more codes
to add some more functionality to the application.
So that is the use of the POS actually.
So DEF is a keyword with the help which were defining one function and then you can call the function
as well.
So now we can see this particular function we are calling.
So there is one argument.
It is decoding, there is a parameter.
So now let me go for the parameters here.
So I'm passing, say, Satine here.
So there will be no error, but obviously there will be no outcome because POS does not produce any
output here.
Next, we are going for the DL.
So this particular deal you see is equal to 10 print A.
So the value of A has got printed S10 delayed.
That means this eight, this 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 that is known as Nimir because the variable does not exist and isn't written as the message.
That name is not defined here.
Because after deleting the variable A will be D.
Look at it from the memory.
So next time, if you go for print day, it will tell you it will raise that name.
Made it here.
We're having this.
If ayliffe and else numb is the goal to do, if Nahm is the goal, is the goal to one, then print one.
If elopements sexually elusive, but here, in case a python will be writing it as a live e-mail, I-F
all always remember after even after Ayliffe will be writing one condition.
This is a condition where writing after the condition that it be one colon discoloring indicate that
we are starting with the block.
Under 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 Fosdick meant with the indentation.
And then we'll be writing this elif with the outer dent without dent you can find that the same indentation
will be maintained for even Elif.
They'll be starting from the same column and none is visible to do.
It will check that the value of NUM is equal to or not.
Then one colon.
So when nobody will give colon and presenter automatically, the castle will be blinking with the new
indent.
So that is a print too.
And else would have been something else.
So did the if Elif and else block anyone else.
They are optional.
If is mandatory.
If we write any conditional block so Elif can oakar for multiple no uptimes 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 the because the now musical musical one is not getting through.
Now musical is illegal to do, too, is not getting through.
So it is coming to the spot.
Now, let us suppose I'm putting.
There is always I'm putting under Jack Deck out of the ayliffe.
So now in this way, what will happen?
It is printing three.
But if I make this one for, then it will be going for the LDS part.
So I think now you are getting this idea of what this IEF ayliffe and LDS block.
Next, we're going for this tri res catch.
And finally, so these are the very important keywords such under the try you will be writing so many
statements.
We can try to block where we're expecting some errors may be raised.
So errors may be raised during the calculations of competitions.
Otherwise, we can also raise our error, if adequate, to do so.
He had one error.
We have raised that is a JIRU division error.
So after this, except this Gedo division error has been mentioned.
So you are going to handle the erroneous condition here.
So then these these are respective remedial body.
And then finally, is that very bocian?
That is.
There is a block on that.
The finally it will be executed even if the any error is occurring 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 part cannot be performed because that the here the res digital division natur has
been raised here.
So but you see the final block is getting executed execution successfully.
So now if we met this one under comment, if you make this one under comment, then what?
We can find that the execution successfully.
This particular statement is getting executed.
That means a finally block will get the control always, irrespective of the fact that any idea has
been raised or not.
We'll be discussing all these aspects in our respective chapters for more detailing.
Let us go four to four.
So these are four is a key word.
So for I in range one, comma ten.
So here disvalue value by you will be ranging from one to nine.
As I told you that the ending limits, the stop Balu will be exclusive.
So here's the value up.
I will be ranging from one to nine, as you didn't mention any step.
So by default, a stable will be one.
So that's why this value up.
I will be increased by one.
By one.
So one come out.
Then technique's one common two common commentary up to the value of ILB ranging up to nine.
So let me go for the print.
You can find that in this way the four 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 keywords.
So input, Matt.
That means we're importing one model.
The name of the model is Matt.
And from Matt.
Matt, Matt.
We are importing this cause.
So little we can use this cause as when required.
But there in that case, you need not to apply.
So I'm just writing this one for this print.
Go for cause.
Say I'm going for a 10 here.
So if you go on 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 are written from math import
corsia.
So I can use this cause method.
According to the same test as I option.
Next, we are having the next keyword that is a global.
So here they are defined.
One variable that is that global var there's a read one which will bring the value of this global var
is the right one.
Here you are mentioning the global word as a variable with the keyword global.
So now this global word is getting updated.
Now using the right to we can also changing this global world with 15.
But here you can find that this global global word, this particular statement is missing.
So this now wasn't going to happen.
So let me go for the execution.
See, at first we have all this read one function, so read one will print the global of our value.
And that is 10 or 10 has got printed.
Now we just call the right one function.
So write one function will defined this global var as a variable here within this right.
And this global keyword is actually indicating that this global votizen is not a new variable, but
the symbol which is there as a global variable.
So we are doing that bit on to that.
So next one is a read.
One function is getting exequatur.
So when you are printing this global, what?
We are not getting distend, but we are getting this updated value.
That is five here.
In case of now, we are calling this right to increase a right to see the global global word.
That statement is missing.
But I think this global over 15.
So what is happening?
This global void is might be having the same name name as that of the global variable.
But as we didn't write global global var here.
So that's why this global effort is working as a local variable within the right to method.
So now what about the bits we're doing.
That's a desktop is confined within this right to method.
So this global var when it will get printed.
I'm going to print the five again.
Not fit in here because we have Gwynfor the read one at the last.
So in this way you can see that in this called how the global keyword has been used.
We're having this in so in actually use for the membership.
So here you have defined one least the least will be enclosed within the square brackets in our in our
python.
So four in a.
So now it is checking with the four is a is a member of this list or not.
So it is producing the output.
True.
But if you write 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 not in.
You can also go for the Nourredine.
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 print, true is true.
So easy is a keyword.
So its outcome is true here to define anonymous functions.
That is, it was a different functions, but no name without any name.
We're using the key word lambda for anybody with defined use that event function with a name.
We are using the Q what Def Def stands for define.
But in case of anonymous function anonymous method the keyword will be lambda.
So here to see lambda.
So the function has got no name.
It will take this X as input argument and it returns it to it does a calculation that is X start to
that is two times it will multiply this value of X and that will be assigned to a.
So far 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 I'll be passed to this method.
And he does returning that to into X.
So two into Y you will be returned.
So I'm going to get insert one.
I shall be getting two.
When the value of I'll 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 being developed by the better understanding.
Next week, Gwynfor, the nonlocal.
So these outer function, we're having this variable, a physical to fight, these are inner function
here to have defined this one as nonlocal a..
And now we are just operating the value up A and from the inner function, we are printing the value
up 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 eight because he is nonlocal eight.
That means this is nonlocal.
That means that there is not locally within this inner function.
That is when using this, eh.
And when nobody was doing some uplift and went about it.
We are printing this one.
I'm getting here 10.
And from the outer function on see if you print this A I shall be getting ten back here.
So here you are discussing the Q word.
That is a non local.
We're having the key word.
That is a pass which are which are discussed already.
So boss will have no outcome.
You can see that.
I run that code, but no outcome has been planned because POS 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 POS because plastic passes nothing but one
placeholder letter for new code insertion.
I can replace POS with the new set up codes.
So that's why you see it is producing no outcome.
So let me call the functional so.
Sam, passing distend is he is producing no outcome here.
Next, we're having this return returnee's, another very important QAD so easy Golu 10 within dysfunction.
The bodies asal 210 and written eight.
So now whenever we are calling this function, the function will return the value apaid.
That is 10.
And we are printing that value here.
So now let Bingel for the execution.
I'm getting 10 here.
So now we are having this while so indicus i while I all the five I agree that then zero I print, I
add Isaac Icicle to a minus one.
So I've written this one as a minus equal to one.
So value of I'll go on printing.
And this process will be continued when the value up I'll be good at Angelo.
So if they execute my code I'll be getting the output for Isaac.
I'll do five, four, three, two and one.
OK.
The next keyword is with.
So with open example dxp w as my file.
So now what will happen.
This exam will go to 60, will be opened in the right mode.
And here that we're using the Q word with.
And to that particular file pointed to this particular file reference where you calling this write method.
And this particular string will get printed onto that example, dark DST.
So now if I go for execution, you can find that the examples are dxp there.
So let me go for the checking example.
The text has been created just a seconds ago and you can find that is body is having only one string.
That is a HelloWallet which you printed here, which you printed here.
So this way we using this with keyword, we can open a file either in the read mode or in the right
mode or in the app in mode.
And we're having a separate section where you discuss that.
What are the different modes?
Are possible land operations are possible on about data files.
So this is a use of that with keyword.
We're having the field.
That is another very important word in our generator.
So, David, generator, we have defined one method.
The name of the method is generator.
And for I in range six.
That means he had this value up.
I will be ranging from Jiru to five six minutes.
The value will be ranging from Dutra to fight.
And here we are not returning anything, is he?
In case of genitive function, we don't have the written statement.
We usually have the error statement.
Yield will go on accumulating all the calculated values.
So what is the value here?
I start I, I will be the engine from zero to five.
So I'm going for the square up that I.
So it will be having the value zero one four nine 16 and five squared.
That is twenty five.
So now it will return one iterator.
So now generator the outcome will be, will be Opt-In 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 genitive functions will be having the key word ealand which will go on accumulating all the
calculated values and letter from this iterator.
We can using the for loop, we can pick up each and every element at a time in one loop, in one iteration
and go on doing the competitions.
But here you have just printed the value of AI here.
So in this particular example, we have discussed multiple different keywords.
You can see that so many different keywords you have defined.
Other than these other 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 codes and we have explained that one with the required outputs.
Thanks for watching this video.