rules for identifiers in python subject
Answers
Answered by
22
Answer:
Python Identifiers
- 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 _ . ...
- An identifier cannot start with a digit. ...
- Keywords cannot be used as identifiers. ...
- We cannot use special symbols like !, @, #, $, % etc. ...
____________________________________☆
Answered by
2
ANSWER
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 a valid name.
3. Keywords cannot be used as identifiers.global = 1Output File "<interactive input>", line 1 global = 1 ^ SyntaxError: invalid syntax
4.We cannot use special symbols like !, @, #, $, % etc. in our identifier.a@ = 0
- Output File "<interactive input>", line 1 a@ = 0 ^ SyntaxError: invalid syntax
5. An identifier can be of any length.
Similar questions