A value is a piece of data a program works with: a number such as 25 or 2.5, or a text such as "Noor". A variable is a name that a program gives to a value, to keep it and use it later.
उदाहरण
Example 15.6 (Tracing five lines)
A dash means that the variable has no value yet.
| line | instruction | a | b |
|---|---|---|---|
| 1 | a = 5 | 5 | – |
| 2 | b = a + 3 | 5 | 8 |
| 3 | a = b * 2 | 16 | 8 |
| 4 | b = b - a | 16 | |
| 5 | print(a, b) | 16 |
The program should print 16 -8. Running it confirms the table: