Which of the following is a valid Python identifier?
Correct answer D. _total2
Explanation
An identifier may contain letters, digits and underscores but must not begin with a digit, so _total2 is valid while 2total is not. total-2 would be parsed as a subtraction expression, and class is a reserved keyword, so it cannot be used as a name.
Answer checked How we write and check questions
Discussion