Question 27 • Introduction to Information Technology - EL3701
Mark and John are developing a program using Python. They name a variable 24_hour_mart, but then recognize that this name violates a Python naming convention. What naming convention does it violate?
Answer
A
Variable names can not include the underscore character (_).
B
Variable names can not begin with a number.
C
Variable names can not exceed ten characters in length.
D
Variable names can not be fewer than fifteen characters in length.
Explanation
A Python variable name may contain underscores, but it cannot start with a digit. The name 24_hour_mart begins with 2, so it is invalid. The underscore is allowed, making “Variable names can not begin with a number” the correct choice.
AI-written and checked against the verified answer.