Just like a single literal, a single variable is an expression all by itself. The value of such an expression is the data value that the variable refers to. So if we tell Python to print a variable to the console, it will display the value of that variable.
The code above will print 10 to the console.
Since variables can be expressions (they evaluate to a value), they can actually go on the right side of an assignment command, like so:
After executing the code above in Python, both x and y will refer to the value 10. It’s important to note that the statement y = x doesn’t establish any kind of permanent equivalence between x and y. It just associates y with whatever value is associated with x at the time that the statement is executed. For example, consider the following code:
This program will print first a 2 then a 10 to the console. The value of y didn’t change just because x later got associated with a new value. This is definitely true with atomic data. The situation is a bit more complicated when we start dealing with lists, but we will deal with that a little later.