Write five valid identifiers in python
Answers
Answered by
9
Identifiers are unique names given to a variable.
- They identify the name of a entity when asked.
- Can consist of letters, numbers and underscores; no other special character can be used.
- They aren't case sensitive.
- They can't start with a number.
Examples:
- XID,
- high_score,
- bot,
- rate_name
- _error
Invalid identifiers would include:
- Price*qty
As it has a special character (*).
- 4thcol
As it starts with a number.
- for
As it is a keyword. Keywords cannot be used as identifiers.
- %rate
As it has a special character (%).
- in
As it is a keyword.
EliteSoul:
Nice :clapping:
Answered by
9
- Identifiers are generally defined as combination of lowercase alphabets,numericals and underscore.
- Some identifiers are pre defined and pre recognised by the system are termed as Keywords. There are around 33 Keywords. Some of them are listed below.
List of some keywords are as follows :
For example, (Refer to the attachment)
There are some rules to be assigned while naming an identifier :
- The first character in the identifier should be non - numeral.
- Any special character in the identifier would render a syntax error in the code.
- Keywords can't be used as Identifiers.
- Identifiers can start with an underscore or alphabets.
For example,
1. my_name,my_number etc would be valid Identifiers
2. @name or #me would render syntax errors
3. 4_ever would cause an error while _4ever is valid.
Attachments:

Similar questions
Math,
6 months ago
Social Sciences,
6 months ago
Math,
6 months ago
Math,
1 year ago
English,
1 year ago
Chemistry,
1 year ago
Political Science,
1 year ago