Concept Flow - Variable assignment in Python
Start
Evaluate right side
Assign value to variable
Variable holds value
End
The program evaluates the value on the right side, then assigns it to the variable on the left side, storing it for later use.
x = 5 name = "Alice" pi = 3.14
| Step | Code Line | Action | Variable | Value |
|---|---|---|---|---|
| 1 | x = 5 | Assign 5 to x | x | 5 |
| 2 | name = "Alice" | Assign "Alice" to name | name | "Alice" |
| 3 | pi = 3.14 | Assign 3.14 to pi | pi | 3.14 |
| 4 | - | No more assignments | - | - |
| Variable | Start | After Step 1 | After Step 2 | After Step 3 |
|---|---|---|---|---|
| x | undefined | 5 | 5 | 5 |
| name | undefined | undefined | "Alice" | "Alice" |
| pi | undefined | undefined | undefined | 3.14 |
Variable assignment syntax: variable = value The right side is evaluated first. The variable stores the value for later use. Assigning again updates the variable. Variables hold values of any type.