Python identifiers are the smaller elements of Python program. We can say, the identifiers are used to identify a variable, module, class, function and other object.
Rules for identifiers are.
Example for identifiers are.
_name Correct
name_ Correct
_name1 Correct
2name Incorrect
name_lastname_1 Correct
@name Incorrect
name@ Incorrect
Name Correct
Name1 Correct
Rules for identifiers are.
- Python identifiers are stared with the alphabet (a-z) or (A -Z) or underscore ( _ ).
- Python identifiers are followed by any alphabet (a-z) or (A-Z), number (0-9) and underscore(_).
- Python identifiers does not start with the digit (number (0-9)) and any special characters (@, % and $ etc.)
- Python identifiers does not have any special characters (@, % and $ etc.)
Example for identifiers are.
_name Correct
name_ Correct
_name1 Correct
2name Incorrect
name_lastname_1 Correct
@name Incorrect
name@ Incorrect
Name Correct
Name1 Correct
Comments
Post a Comment