Which keys follow Python naming rules and conventions?
hard
A. 'user_age' only
B. All keys are valid
C. 'UserName' only
D. 'UserName' and 'user_age' only
Solution
Step 1: Check each key for naming rules
'UserName' starts with a letter and uses CapitalizedWords (good for class names). 'user_age' uses lowercase with underscore (good for variables). '2ndUser' starts with a number, which is invalid.
Step 2: Identify keys following naming conventions
'UserName' and 'user_age' follow naming rules; '2ndUser' does not.
Final Answer:
'UserName' and 'user_age' only -> Option D
Quick Check:
Keys must start with letter; numbers not allowed [OK]
Hint: Keys must start with letter; numbers not allowed [OK]
Common Mistakes:
Allowing keys starting with numbers
Ignoring naming conventions for readability
Assuming all strings are valid variable names
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.