An identifier is a name given to program elements such as variable,classes and functions etc. An identifier is a sequence of letters, digits and underscore, the first character of which can not be a digit.
Example:- number=10 , here a variable name(number) is an identifier. def factorial (n) , here a function name(factorial) is an identifier. class recur , here a class name(recur) is an identifier.
Following rules must be follow while naming an identifier :-
The first character must be an alphabet (uppercase or lowercase) or can be an underscore.
An identifier can not start with a digit.
No special characters like @, &,$,#,% etc. is allowed except the underscore.
No two successive ( _ ) underscore are allowed.
Keywords can not be used as an identifiers.
Python Keywords
Python keywords are set words that cannot be used as an identifier in program. These words are known as "reserved words" or "keywords".
There are some available keywords in python programming language:-
No comments:
Post a Comment