Practice mode Python

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.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.