Values, Variables & Expressions — Lesson 1: Names for changing information
New skill: Variables and assignment
Previously learned: Unit 01 — output, execution, and debugging
Why this matters
Programs often need to remember data rather than typing it repeatedly. A variable is a name for a value.
Study this example
player = 'Nova'
print('Player:', player)
player = 'Atlas'
print('Player:', player)
Assignment uses a single equals sign. Python uses the current value when it reaches each print statement. Renaming the player changes later output, not previous output.
Before moving on, trace each line of the example by hand. Predict the result before running it in the browser.
Check your understanding
What does the second print statement show? Why?
Common mistake
Text values require quotation marks, but variable names do not.
Practice: Names for changing information
Create a variable named player storing the text Nova. Display exactly Player: Nova using the variable and print().
Expected console output
Player: Nova
Starter file: main.py
Use Run to experiment and Check to compare against published examples. A passing public example does not automatically establish mastery.
Hint 1 — Identify the key concept
How do you store text in a variable?Hint 2 — Find an approach
`print()` can accept a label and a variable separated by a comma.Hint 3 — Check your answer
Check the space after the colon in the displayed output.Reflection
Write a short explanation of why your code works. What input or change would make it behave differently?