Identifiers and Reserved Words Flashcards
(19 cards)
What is a name in a Python program called?
Identifier
What types of names can be considered identifiers in Python?
Class name, function name, module name, variable name
What characters are allowed in Python identifiers?
Alphabet symbols, digits, underscore
What happens if an invalid character is used in an identifier?
Syntax error
Is it valid to start an identifier with a digit?
No
Are identifiers in Python case sensitive?
Yes
What does it indicate if an identifier starts with an underscore (_)?
It is private
Can reserved words be used as identifiers in Python?
No
What is the maximum length for Python identifiers?
No length limit, but lengthy identifiers are not recommended
Which of the following is a valid Python identifier? ‘total123’, ‘123total’, ‘ca$h’, ‘abc_abc’
total123, abc_abc
How many reserved words are available in Python?
33
List three examples of reserved words in Python.
- True
- False
- None
What are reserved words in Python?
Words reserved to represent some meaning or functionality
What do all reserved words in Python contain?
Only alphabet symbols
Which reserved words in Python contain uppercase letters?
- True
- False
- None
Is ‘a = true’ a valid statement in Python?
No
Is ‘a = True’ a valid statement in Python?
Yes
What does it indicate if an identifier starts with two underscores?
It indicates a strongly private identifier
What are identifiers that start and end with two underscores called?
Language defined special names or magic methods