In Python, we can convert one type of variable to another type. This conversion is called type casting or type conversion.
In casting, we convert variables declared in specific data types to the different data types.
Python performs the following two types of casting.
Implicit casting: The Python interpreter automatically performs an implicit type conversion, which avoids loss of data.
Explicit casting: The explicit type conversion is performed by the user using built-in functions.
To perform a type casting, we are going to use the following built-in functions:
- int(): convert any type variable to the integer type.
- float(): convert any type variable to the float type.
- complex(): convert any type variable to the complex type.
- bool(): convert any type variable to the bool type.
- str(): convert any type variable to the string type.
In type casting, data loss may occur because we enforce the object to a specific data type.
I'd like to introduce each of them respectively in the following articles.



