Python Identifiers and Reserve keywords

python identifiers

 Python Identifiers is the name that we use for identifying the different variables, classes, methods, objects, etc. in a program. Each identifier name has to be unique and can’t be used twice in the program for the declaration of variables, classes, or methods.

Basic Rule to Create a python Identifiers

  • It should start with small case a to z or capital case A to Z, or with underscore sign (_). After assigning the first letter, you can use digits as well from 0 to 9. 
  • Special characters like $, @, % are not allowed to be used in the identifiers.

Don’t use like this

ru$h =10

# it will show 

SyntaxError: invalid syntax
  •  The identifier is case-sensitive.

Don’t use like this

123python = 10

# it will show 

SyntaxError: invalid syntax
  • You can’t use a reserved word as an identifier in Python, such as break, class, while, lambda, for, from, print, raise, etc. 

Use Like this Below Example

# few examples of identifiers

num = 100

_x = 1000

a_b = 999



Read 👉 Loops in python

Things to Remember

  •  All Class names will start with A-Z. The remaining identifiers can be written as a-z. example Employee, Students, Hospital.
  • if the identifier starts with a single underscore, it means that it is a private identifier. 
  • identifier starts with a double underscore, it means that it is a strongly private identifier. 
  • identifier ends with a double underscore, it means that it is a language-specific identifier name.

Read 👉 Tuple in python

What are the Python Reserved words/keywords?

The words which are reserved to represent some meaning are functionality, such types of words called reserved words. contains.

Python keywords

There are 33 keywords in python.

All reserved keywords in python contain only alphabet symbol.

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

 Except the following all contains only lower case alphabets symbols. 

  • True,
  • False,
  • None