Updating Variable Values in Python.md

Updating Variable Values in Python.md

Lesson 10. Updating Variable Values

You can reassign or update variable values anytime — Python will simply overwrite the previous one:

score = 50
print(score)  # Output: 50

score = 75
print(score)  # Output: 75

Tip: Python variables are dynamic — their value and even data type can change during execution.

🧩 Try It Yourself

  1. Create three variables and assign them the same number (e.g., x = y = z = 5).
  2. Print their values.
  3. Now assign three different values in a single line (e.g., a, b, c = 1, 2, 3) and print again.

Example:

x = y = z = 5
print(x, y, z)

a, b, c = 1, 2, 3
print(a, b, c)

Output:

5 5 5
1 2 3

Now that you understand Updating Variables values in Python, your next lesson is to learn about Swapping Variable Values in Python in detail.