What is Identifiers in Python Programming | Part-2

What is identifiers in python programming

IDENTIFIERS

A Name in Python Program is called Identifier. 
  • It can be Class Name OR Function Name OR Module Name OR Variable Name.
  • a = 10

Rules to define Identifiers in Python:

1. The only allowed characters in Python are
  • alphabet symbols(either lower case or upper case) 
  • digits(0 to 9) 
  • underscore symbol(_)
By mistake, if we are using any other symbol like $ then we will get syntax error.
  • cash = 10 √ 
  • ca$h =20 ✖
2. Identifier should not start with the digit
  • 123total ✖ 
  • total123 √
3. Identifiers are case sensitive. Of course, Python language is case sensitive language.
  • total=10 
  • TOTAL=999 
  • print(total) #10 
  • print(TOTAL) #999

Identifier:

  • Alphabet Symbols (Either Upper case OR Lower case)
  • An identifier should not start with Digits.
  • Identifiers are case sensitive.
  • We cannot use reserved words as identifiers Eg: def = 10 ✖
  • There is no length limit for Python identifiers. But not recommended to use too lengthy identifiers.
  • Dollar ($) Symbol is not allowed in Python.

Post a Comment

0 Comments