Implicit Type Conversion
It is a type of type conversion in which handles automatically convert one data type to another without any user involvement.
Example:
Python3
# Python program to demonstrate # implicit type conversion # Python automatically converts # a to int a = 5 print ( type (a)) # Python automatically converts # b to float b = 1.0 print ( type (b)) # Python automatically converts # c to int as it is a floor division c = a / / b print (c) print ( type (c)) |
Output:
<class 'int'> <class 'float'> 5.0 <class 'float'>
In the above example, it can be seen that Python handles all the type conversion automatically without any user involvement.
How To Convert Data Types in Python 3?
Prerequisites: Python Data Types
Type conversion is the process of converting one data type to another. There can be two types of type conversion in Python –
- Implicit Type Conversion
- Explicit Type Conversion