Python Keywords and Identifier

Keywords
Keywords are the reserved words in Python. We cannot use a keyword as variable name, function name or any other identifier. They are used to define the syntax and structure of the Python language. In Python, keywords are case sensitive. Python is a dynamic language. It changes during time. The list of keywords may change in the future. There are 33 keywords in Python 3.3.

alse class finally is return
None continue for lambda try
True def from nonlocal while
and del global not with
as elif if or yield
assert else import pass
break except in raise

Identifiers
Identifier is the name given to entities like class, functions, variables etc. in Python. It helps differentiating one entity from another.
Rules for writing identifiers in Python:

  • Identifiers can be a combination of letters in lowercase (a to z) or uppercase (A to Z) or digits (0 to 9) or an underscore (_). Names like myClass, var_1 and print_this_to_screen, all are valid example.
  • An identifier cannot start with a digit. 1variable is invalid, but variable1 is perfectly fine.
  • Keywords cannot be used as identifiers.
  • We cannot use special symbols like !, @, #, $, % etc. in our identifier.
  • Identifier can be of any length.