Give values clear names, use them, and track how they change.
Recognize what kind of value you have, then choose a name that identifies its role.
A meaningful name makes a value easier to reuse and understand.
92
A Value Alone
The value exists, but its purpose is not clear.
score = 92
A Named Value
The name score tells us what 92 means and lets us use it again.
Python creates a name when an assignment runs.
What happens when Python runs this code?
Evaluate the right side, then bind the result to the name on the left.
⬅️
total = 12 + 3
Evaluate the right side, then bind the result to the name on the left.
Data flows from right to left.
= assigns a value; it is not a mathematical equal sign.
The right side is evaluated first.
The result is connected to the left-side name.
Data flows from right to left.
What value is bound to total?
When Python sees a variable name, it uses that name's current value.
Read the code from top to bottom. What is printed?
Read the code from top to bottom. What is printed?
Read the code from top to bottom. What is printed?
Running another assignment changes the value currently connected to that name.
Reassigning score does not recalculate total automatically.
Track each assignment. What is printed?
Track each assignment. What is printed?
A variable name must be legal Python and should be clear to people.
score ≠ ScoreclassUse snake_case: student_score, is_ready
Use meaningful names: score > s
Use consistent lowercase style: total > Total
Avoid hiding built-in names: input, str
Click each name to reveal whether its syntax is valid Python.
Green means syntactically valid, not always recommended.Names such as Total and input should still be improved.
Complete it on time and submit it before the deadline.
Key takeaways from this lesson.
Name
A variable gives a reusable name to a current value.
Assign
Evaluate the right side, then bind the result to the left-side name.
Update
Reassignment changes the name's current value, not earlier results.
Name Clearly
Use legal, meaningful snake_case names with consistent capitalization.
Separate syntax rules from good naming choices.
1. Classify each name as valid, invalid, or valid but avoid.
2. Rewrite every invalid or unsuitable name as clear snake_case.
player_score 3lives class student-name Total is_ready input
Write the three outputs before running the program.
1. Predict the value printed by each line.
2. Run the program and correct any prediction that differs.
Store profile data in clearly named variables.
1. Create variables for a student name, age, favorite subject, and ready status.
2. Use meaningful snake_case names.
3. Print all four variables and run the program.
Show the score before and after an update.
1. Print the original total.
2. Reassign score to 20.
3. Calculate total again and print the updated total.
4. Confirm that the two displayed totals are different.
Repair the naming error without changing the intended values.
1. Predict the first output and identify why the second print fails.
2. Repair the smallest naming mistake.
3. Run the program and confirm that it prints 15 and 20.
4. Explain why total_score stays 15.