Sr. |
Keyword |
Description |
1 |
and |
It is used for logical operations, it is a logical AND operator. It returns "True" if both operands are True. |
2 |
as |
It is used to create an alias of a module. |
3 |
assert |
It is used for debugging purpose, it returns an "AssertionError" if the given test condition is False. |
4 |
break |
break the loop's execution. It is used to transfer program's control from a scope of loop body to the next statement written after the loop body. |
5 |
class |
It is used to define/create a class. |
6 |
continue |
It leaves the rest of the statements in the loop body and continues the next iteration of the loop. |
7 |
def |
It is used to define/create a function. |
8 |
del |
It is used to delete an object. |
9 |
elif |
It is used with "if...elif...else" statement to check next condition. It is the same as "else if" of C, C++ language. |
10 |
else |
It is used with "if...elif...else" statement to define an else block – if any condition is not True, else block executes. |
11 |
except |
Just like "catch" block in the other programming languages, it is used to define an "except" block that executes if any exception occurs in the try block. |
12 |
False |
It is used to define a Boolean value False, it may also the result of a comparisons expression. |
13 |
finally |
It is used with the exceptions block (try...except...finally), it defines a code block that executes always – not matter "try" block has an exception or not. |
14 |
for |
It is used to create a for loop. |
15 |
from |
It is used to import a specific section (like functions, classes, etc) from a module. |
16 |
if |
It is used to create a conditional statement i.e. to check the condition. |
17 |
import |
It is used to import a module in the program. |
18 |
in |
It is used to check whether an element present in a sequence like string, list, tuple, etc. |
19 |
is |
It is used to check whether two objects are the same objects or not. |
20 |
lambda |
It is used to create an anonymous function that can have multiple arguments but a single statement/expression. |
21 |
None |
It is similar to the null, it is used to define a null value. |
22 |
nonlocal |
It is used to declare a non-local variable, by using this keyword, we can instruct the compiler that the variable is not a local variable. |
23 |
not |
It is a logical operator (logical NOT) and returns "True" if the operand is "False" or returns "False" if the operand is "True". |
24 |
or |
It is a logical operator (logical OR), it is used to combine two conditions and returns "True" if any condition is "True", else it returns "False". |
25 |
pass |
It is used as a null statement, it is very useful to define a blank function or a blank body of a conditional statement. |
26 |
raise |
It is used to raise an error and displays a customized message. |
27 |
return |
To return a value or/and returns the program's control from calling a function to called function i.e. it is used to exit from the function. |
28 |
True |
It is used to define a Boolean value False, it may also the result of a comparisons expression. |
29 |
try |
It is used with "try...except...finally" block. |
30 |
while |
It is used to create a while loop. |
31 |
with |
It is similar to "using" in C#.Net and VB.Net, it is used to simplify the exception handling. |
32 |
yield |
It is used to end a function and returns a generator. |