Which of the following identifier names are invalid and why?
1. Serial no.
2. Total Marks
3. 1st Room
4. total-Marks
5. Hundreds
6. Percentage
7. Total Marks
8. True
Answers
Answer:
Serial_no.: Invalid - Identifier in python cannot contain any special character except underscore(_).
Total Marks: Invalid - Identifier in Python cannot contain any special character except underscore(_). If more than one word is used as a variable then it can be separated using underscore ( _ ), instead of space.
1st_Room: Invalid - Identifier in Python cannot start with a number.
total-Marks: Invalid - Identifier in Python cannot contain any special character except underscore(_). If more than one word is used as a variable then it can be separated using underscore ( _ ), instead of a hyphen ( - ).
Hundred$: Invalid - Identifier in Python cannot contain any special character except underscore(_).
_Percentage: Valid
True: Invalid - Identifier in Python should not be a reserved keyword.