Like other programming languages, Python also has some reserved words whose meaning is already defined by the Python interpreter these reserved words are known as Keywords.
A keyword cannot be used as the identifier. For example, you can not use a variable with the name def
because it is a Python keyword that is used to define a function.
List of keywords in Python
The following table shows the list of Python keywords.
Here keywords await
and async
were recently added in Python 3.7, print and exec were keywords in Python 2.7 now these are changed into built-in Python functions.
You can see the updated list of these keywords in your terminal by using –
help("keywords")
As given in the image below –
Display information of a keyword
You can view the information of each keyword in the terminal by using the help function.
For example to view the details of for
keyword use –
help("for")
This will display about for
keyword in python along with example you can scroll it to see the complete information.
In python programming, each keyword has its own use. We have seen a few of them in previous articles in upcoming tutorials we will explain to them whenever we use them.
Conclusion
You should know how to use a Python keyword. Before using them first understand them properly. Now if you find any difficulty while using a keyword then write us in the comments below.