Identifiers in python

In this tutorial you will learn about Identifiers in python which can be anything variables, types, label function etc.

  • The name variable is an identifier.
  • Identifiers can denote various entities like variable, types, label functions , packages and so on.
  • Rules for writing identifiers in python:
    1. Variable name can be short with letters a to z or A to Z, underscore. e.g. myclass, var_1.
    2. Variable name contains both letters and numbers.
    3. Variable name cannot start with digit. e.g. 1 var, 1 roll number.
    4. Keyword cannot be used as variable, name. e.g. global, if.
    5. Special symbol like !, @, #, $, % cannot be used as variable name.
    6. Variable name can be of any length.
    7. Python is case sensitive language. e.g. Var and var are not the same.

What are the rules for identifiers?

Variable name can be short with letters a to z or A to Z, underscore. e.g. myclass, var_1.
Variable name contains both letters and numbers.
Variable name cannot start with digit. e.g. 1 var, 1 roll number.
Keyword cannot be used as variable, name. e.g. global, if.
Special symbol like !, @, #, $, % cannot be used as variable name.
Variable name can be of any length.
Python is case sensitive language. e.g. Var and var are not the same.

Leave a Reply