Informatics Practices
Identify invalid variable names from the following, giving reason for each:
Group, if, total marks, S.I., volume, tot_strength, #tag, tag, 9a
Python Funda
4 Likes
Answer
- Group — It is a valid variable name.
- if — It is a reserved keyword in Python and cannot be used as a variable name.
- total marks — It contains a space, which is not allowed in variable names.
- S.I. — It contains a dot (.), which is not allowed in variable names.
- volume — It is a valid variable name.
- tot_strength — It is a valid variable name.
- #tag — It starts with a hash (#), which is not allowed in variable names.
- tag — It contains a dollar sign (), which is not allowed in variable names.
- 9a — It starts with a number, which is not allowed in variable names.
Answered By
2 Likes