Q.Which of the following is not a valid variable name in Python? Justify reason for it not being a valid name.
You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.
Start your 14-day free trial to unlock the full solution →Python variable names must start with a letter or underscore, not a digit. 5Radius starts with a digit, so it is invalid. The valid names are Radius_, _Radius, and Radius.
The core rule here is simple: Python follows the same naming convention as most programming languages — a variable name must begin with either a letter (a–z, A–Z) or an underscore (_). It cannot start with a digit. After the first character, you can use letters, digits, or underscores freely.
Why this rule? It prevents ambiguity. If 5Radius were allowed, the interpreter wouldn't know whether 5 is part of a number or a variable name. For example, 5Radius + 3 could be read as 5 (a number) plus Radius (a variable) plus 3, or as a single variable 5Radius plus 3. To avoid this confusion, the language simply forbids names starting with a digit.
Let's check each option:
-
5Radius— Starts with the digit5. This violates the rule. Python will raise aSyntaxErrorif you try to use it.Watch outA common mistake is thinking that digits anywhere in a name are fine — they are, but not at the start.
Radius5is perfectly valid;5Radiusis not. -
Radius_— Starts with a letter (R), followed by letters and an underscore. Allowed. Perfectly valid. …
Unlock everything free for 14 days
- Full step-by-step solutions
- Concept-first explanations
- Methods, shortcuts & mistakes
- PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.