Keywords in Python Programming Language
KEYWORDS:
Definition - The Keywords are reserved and predefined words in Python that have specialized meaning or outcomes. Keywords can be used to define the syntax of the code or program. All the Keywords written in Python are lowercase except True or False.
Note: Keywords can never be used as Identifiers, Functions or Variable Names.
In the Count, There are Total 33 Keywords in Python Programming Language.
So, Let's Get Started with Each Keyword and their Description of Use.
- and - This is a logical operator. It returns true if both the operands are true else it will return false.
- or - This is also a Logical Operator. It returns true if anyone operand is true else it will display or return false.
- not - It's also a Logical Operator. It will return True if operand is false else will return false.
- if - This is used to create a conditional statement.
- elif - Elif is a conditional statement used with if statement. The elif statement is executed if the previous conditions were not true.
- else - Else is used with if and elif statements. Else Block is executed if the given condition is not true.
- for - This is Created or to Make a Loop.
- while - This Keyword is used to create or make while loop.
- break - This is used to break or terminate the loop.
- as - This is used to create another option or alternative.
- def - It helps us to define functions.
- lambda - It is used to define the unknown or anonymous functions.
- pass - This is a null statement that means it will do nothing in the program.
- return - It will return the given value and exit the function.
- True - This is a Boolean Value.
- False - This is a Boolean Value.
- try - It makes a try-except statement.
- with - The with keyword is used to simplify exception handling.
- assert - This is the Function used for debugging purposes. It checks the bugs of the code.
- class - It defines a class.
- continue - It continues to iteration (next) of a loop.
- del - It deletes a reference to an object.
- except - Used with exceptions, what to do when an exception comes.
- finally - It's used with exceptions, a code block that is executed no matter if there is an exception or not.
- from - The form is used to import specific parts of any module.
- global - This Declares a Global Variable.
- import - Imports a Module.
- in - Checks if a value is present in a tuple, list or not.
- is - Checks if two variables are equal or not.
- None - It's a Special Constants. It denotes a null value.
- nonlocal - Declares a non-local variable.
- raise - This Raises an Exception.
- yield - It Ends a Function and returns a generator.