Python identifiers an Introduction

In this article, you learn about Python identifiers. In Python, identifiers are the names given to identify variables, functions, classes, modules, etc.

Identifiers are like the names that your parents gave you for your identification. Similarly, in Python programming, a programmer can write identifiers to identify different objects.

Example 1: Python identifiers

Age = 27
A= 5
FirstName = “john”

In the above example “age”, “a” and “FirstName” are identifiers.

Rules to writing a valid Python identifier

In Python, there are some rules to write valid identifiers that are given below.

  1. The identifier can be letters, digits, and underscore (Aa-Zz, 0-9, and _)
  2. An identifier cannot begin with digits but can start with an underscore and letters
  3. Keywords cannot be used as identifiers
  4. They are case sensitive which means “A” and “a” are two different identifiers
  5. We cannot use special symbols as an identifiers

Example 2: Some valid Python identifiers


Example 3: Some invalid Python identifiers

Student Marks