Python Programming – KeywordsReserved Words

You can learn about Introduction to Python Programming Programs with Outputs helped you to understand the language better.

Python Programming – Keywords/Reserved Words

At the time of designing a language, some words are reserved to do specific tasks. Such words are called keywords or reserved words. Keywords cannot be used as variable names. In Python, they are case-sensitive. Table 3.3 shows a list of Python language keywords. Note that all keywords are in the small cases except False, None, and True. To display a list of keywords in Python write the following commands:

>>> import keyword
>>> print (keyword.kwlist)
List of Python keywords will appear as shown in Figure 3.22

Difference between Keywords and Identifiers

Keywords are the words used by Python interpreters to recognize the structure of the program. As these words have specific meanings for interpreters, they cannot be used for any other purpose. So, keywords are reserved. They are in-built.

An identifier is a unique name that enables you to identify something. Identifiers are used to label variables, functions, classes, objects, and modules. They begin with either a letter or an underscore. They can contain letters, underscores, or digits but they cannot contain punctuation marks. They are user-defined.

  • The identifier is a user-defined name given to part of pro¬gram namely variable, object, function, etc.

Leave a Reply

Your email address will not be published. Required fields are marked *