Q: Which of the below claims about variable names in Python is true?
-
A
All variable names must begin with an underscore.
-
B
Unlimited length
-
C
The variable name length is a maximum of 2.
-
D
All of the above
B
Answer:
B
Explanation:
In Python, there is no limit on the length of variable names. You can use a variable name of any length as long as it follows the rules for naming variables in Python.
Here are the rules for naming variables in Python:
Variable names can only contain letters, digits, and underscores.
They can start with a letter or an underscore, but not with a digit.
Variable names are case-sensitive.
For example, foo and Foo are different variables.
Variable names cannot be the same as any of the Python keywords.
Related Topic:
Share Above MCQ