Python identifier

What is identifier?

Identifier is nothing but name in python program. it can be class-name , function-name , variable-name , module-name.


Allowed character

 Alphate (uppercase or lowercase)

 Digits (0-9)

 Underscore ( _ )

var1=10

Var2=20

VAR_3=30

print(var1)

print(Var2)

print(VAR_3)


Should not be start with digit.

1var=10

print(1var)

SyntaxError: invalid decimal literal


Case sensitive

var1=10

print(VAR1)

NameError: name 'VAR1' is not defined


We can not use reserve word.

True=20

print(True)

SyntaxError: cannot assign to True

Comments