python tutorial - Python Identifier - learn python - python programming
- A Python identifier is a name used to identify a variable, function, class, module or other object.
- An identifier starts with a letter A to Z or a to z or an underscore (_) followed by zero or more letters, underscores and digits (0 to 9).
- Identifiers are the names given to the fundamental building blocks in a program.
- These can be variables, class, object, functions, lists, dictionaries etc.
- There are certain rules defined for naming i.e., Identifiers.
- An identifier is a long sequence of characters and numbers.
- No special character except underscore ( _ ) can be used as an identifier.
- Keyword should not be used as an identifier name.
- Python is case sensitive. So using case is significant.
- First character of an identifier can be character, underscore ( _ ) but not digit.
- Examples of valid identifier names are i, __my_name, name_23 and a1b2_c3.
- Examples of invalid identifier names are 2things, this is spaced out and my-name.
Rules for writing identifiers:
- 1. Identifiers can be a combination of letters in lowercase (a to z) or uppercase (A to Z) or digits (0 to 9) or an underscore (_). Names like myClass, var_1 and print_this_to_screen, all are valid example.
- 2. An identifier cannot start with a digit. 1variable is invalid, but variable1 is perfectly fine.
- Keywords cannot be used as identifiers.
- We cannot use special symbols like !, @, #, $, % etc. in our identifier.
- Identifier can be of any length.
Wikitechy tutorial site provides you all the learn python , python cursus online , python programming course free , where to learn python programming , free online python course , online free python course , learn python coding online , python developers , python certification free , python learning course , online course python