Bird
0
0

You need to rename variables in this code to follow Python conventions:

hard📝 Application Q9 of 15
Python - Variables and Dynamic Typing
You need to rename variables in this code to follow Python conventions:
FirstName = 'Alice'
LastName = 'Smith'
AGE = 30

Which is the best way to rename them?
Afirstname, lastname, AGE
BFirst_Name, Last_Name, Age
Cfirst_name, last_name, age
DfirstName, lastName, age
Step-by-Step Solution
Solution:
  1. Step 1: Recall Python variable naming conventions

    Variables should use snake_case: all lowercase letters with underscores between words.
  2. Step 2: Evaluate options

    first_name, last_name, age uses snake_case correctly. First_Name, Last_Name, Age uses CamelCase with uppercase initials, which is for classes. firstname, lastname, AGE uses lowercase but no underscores and uppercase AGE, which is usually for constants. firstName, lastName, age uses camelCase, which is not standard in Python.
  3. Final Answer:

    first_name, last_name, age -> Option C
  4. Quick Check:

    Use snake_case for variables in Python [OK]
Quick Trick: Use snake_case: lowercase with underscores for variables [OK]
Common Mistakes:
MISTAKES
  • Using CamelCase for variables
  • Using uppercase for normal variables
  • Using camelCase instead of snake_case

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes