State True or False
"An identifier in Python can start with a digit, but not with an underscore."
Answer by student
Detailed answer by teachoo
- An identifier is a name given to a variable, function, class, module or any other object in Python.
- An identifier can start with an underscore (_) or a letter, but not with a digit.
- For example, _name, name, and name_1 are valid identifiers, but 1_name and name-1 are not.
- An underscore at the beginning of an identifier has a special meaning in Python. It indicates that the identifier is private or protected and should not be accessed from outside the class or module.
- For example, _name is a private variable and name is a special variable that holds the name of the module.
- Therefore, the statement “An identifier in Python can start with a digit, but not with an underscore.” is false.
So, the correct answer is False.