Variables
As discussed above, variable
s can store data. Data values can be assigned to a variable by using the assignment operator
, which is the equal sign
(=).
Once a value is assigned to the variable, it corresponds to that value unless it is re-assigned. Suppose we assign a value 5 to a variable a
. This concept can be visualized as below.

This ensures that whenever we use the variable a
in our program, we will get a value of 5. Let's understand this with code examples in Python.