A Python variable is a symbolic name that refers to a Python object.
A variable is created automatically when an object is assigned to it.
The equal sign ( = ) is used to assign an object to a variable.
Example
n = 300
When the Python interpreter executes this statement, it does the following:
int (integer: integer)300nn as a reference to this object.
The built-in function type() returns the class of an object as a result.
Example
n = 300
print(type(n))
Executing this instruction displays the following message:
<class 'int'>
An object is created in memory only once and can be referenced by multiple variables.
Example
m = n
When the Python interpreter executes this statement, it does not create a new object.
It simply creates a new symbolic name m that references the same object referenced by n.

Example
m = 400
When the Python interpreter executes this statement, it creates an object that is an instance of the int class, assigns the value 400 to that object, and declares m as a reference to that object.

Example
n = 'foo'
print(type(n))
When the Python interpreter executes this statement, it creates an object that is an instance of the str (string) class, assigns the value "foo" to that object, and declares n as a reference to that object.
The object of the class int having the value 300 and previously referenced by n is no longer referenced by any name and is no longer accessible, it has become
orphaned.
A process called garbage collector will clean this object from memory and free the memory location allocated to it

The predefined function print() is used to display the value of a variable.
Example
counter = 1
print(counter)
The del statement is used to delete a variable.
Example
del counter
The casting allows you to specify the class of an object referenced by a variable.
Example
x = str(10)
y = int(10)
z = float(10)
x references an object of the class str: its value will be the string '10'.y references an object of the class int: its value will be the integer 10.z references an object of the class float: its value will be the real number 10.0.
Each created object is assigned a number that uniquely identifies it.
The predefined function id() returns as a result the integer identifying an object.
Example
n = 300
print(id(n))
m = 400
print(id(m))
Executing these instructions will display for example the following values:
140295332911888
140295332914800
n = 300
print(type(n))
m = n
print(id(n))
print(id(m))
m = 400
print(id(m))
n = "Python"
print(type(n))
x = str(10)
print(x)
y = int(10)
print(y)
z = float(10)
print(z)