Identifier and Keyword

An identifier is a sequence of characters used to provide a name for variables, functions, classes, and other program elements. elements within a program.

Rules for Identifier

  1. Python is case-sensitive, meaning Line and line are distinct identifiers.
  2. Identifiers can contain letters, digits, and underscores (_). However, they cannot begin with a digit.
  3. Underscores are often used to enhance the readability of long identifier names, but they should not be the first character.
  4. Spaces are not permitted within identifiers. Using spaces would split the identifier into two separate entities, causing a syntax error.

Keywords

  • keyword is an identifier that has predefined meaning in a programming language. Therefore, keywords cannot be used as “regular” identifiers. Doing so will result in a syntax error.

Use the help() function to explore Python’s keywords and understand their predefined meanings.