{"id":638,"date":"2021-02-25T09:21:28","date_gmt":"2021-02-25T03:51:28","guid":{"rendered":"https:\/\/cbsepython.in\/?p=638"},"modified":"2021-04-30T11:07:44","modified_gmt":"2021-04-30T05:37:44","slug":"what-are-identifiers-and-keywords-in-python","status":"publish","type":"post","link":"https:\/\/cbsepython.in\/what-are-identifiers-and-keywords-in-python\/","title":{"rendered":"What are Identifiers and Keywords in Python"},"content":{"rendered":"<h2>What are Identifiers and Keywords in Python<\/h2>\n<h3><em>What are Identifiers in Python<\/em><\/h3>\n<h4>Python Identifiers<\/h4>\n<p>A Python identifier is a name used to identify a variable, function, class, module or other object. An identifier starts with a letter A to Z or a to z or an underscore (_) followed by zero or more letters, underscores and digits (0 to 9).<\/p>\n<p>Python does not allow punctuation characters such as @, $, and % within identifiers. Python is a case sensitive programming language. Thus,\u00a0<strong>Manpower<\/strong>\u00a0and\u00a0<strong>manpower<\/strong>\u00a0are two different identifiers in Python.<\/p>\n<p>Here are naming conventions for Python identifiers \u2212<\/p>\n<ul>\n<li>Class names start with an uppercase letter. All other identifiers start with a lowercase letter.<\/li>\n<li>Starting an identifier with a single leading underscore indicates that the identifier is private.<\/li>\n<li>Starting an identifier with two leading underscores indicates a strongly private identifier.<\/li>\n<li>If the identifier also ends with two trailing underscores, the identifier is a language-defined special name.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h3>What are the Keywords in Python<\/h3>\n<h3>Reserved Words<\/h3>\n<p>The following list shows the Python keywords. These are reserved words and you cannot use them as constant or variable or any other identifier names. All the Python keywords contain lowercase letters only.<\/p>\n<table width=\"739\">\n<tbody>\n<tr>\n<td>And<\/td>\n<td>exec<\/td>\n<td>not<\/td>\n<\/tr>\n<tr>\n<td>Assert<\/td>\n<td>finally<\/td>\n<td>or<\/td>\n<\/tr>\n<tr>\n<td>Break<\/td>\n<td>for<\/td>\n<td>pass<\/td>\n<\/tr>\n<tr>\n<td>Class<\/td>\n<td>from<\/td>\n<td>print<\/td>\n<\/tr>\n<tr>\n<td>Continue<\/td>\n<td>global<\/td>\n<td>raise<\/td>\n<\/tr>\n<tr>\n<td>Def<\/td>\n<td>if<\/td>\n<td>return<\/td>\n<\/tr>\n<tr>\n<td>Del<\/td>\n<td>import<\/td>\n<td>try<\/td>\n<\/tr>\n<tr>\n<td>Elif<\/td>\n<td>in<\/td>\n<td>while<\/td>\n<\/tr>\n<tr>\n<td>Else<\/td>\n<td>is<\/td>\n<td>with<\/td>\n<\/tr>\n<tr>\n<td>Except<\/td>\n<td>lambda<\/td>\n<td>yield<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>For checking and displaying the list of keywords available in Python, you have to write the following statements-<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import keyword\r\nprint(keyword.kwlist)<\/pre>\n<p>This will give you the following output.<\/p>\n<pre>['and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'exec', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'not', 'or', 'pass', 'print', 'raise', 'return', 'try', 'while', 'with', 'yield']<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>What are Identifiers and Keywords in Python What are Identifiers in Python Python Identifiers A Python identifier is a name used to identify a variable, function, class, module or other object. An identifier starts with a letter A to Z or a to z or an underscore (_) followed by zero or more letters, underscores [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[],"class_list":["post-638","post","type-post","status-publish","format-standard","hentry","category-cbse-computer-science-with-python-class-12"],"_links":{"self":[{"href":"https:\/\/cbsepython.in\/wp-json\/wp\/v2\/posts\/638","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cbsepython.in\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cbsepython.in\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cbsepython.in\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/cbsepython.in\/wp-json\/wp\/v2\/comments?post=638"}],"version-history":[{"count":0,"href":"https:\/\/cbsepython.in\/wp-json\/wp\/v2\/posts\/638\/revisions"}],"wp:attachment":[{"href":"https:\/\/cbsepython.in\/wp-json\/wp\/v2\/media?parent=638"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cbsepython.in\/wp-json\/wp\/v2\/categories?post=638"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cbsepython.in\/wp-json\/wp\/v2\/tags?post=638"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}