If Python needs to convert a variable to another data type, it does so automatically.
For example,
myInt = 5
myFloat = 1.6
mySum = myInt + myFloat
print(mySum)
In this case, Python automatically promoted myInt
to a floating point value and then added.
Suppose you actually wanted an integer. We could use this example
myInt = 5
myFloat = 1.6
mySum = myInt + int(myFloat)
print(mySum)
In this case we’ve explicitly converted myFloat
to an integer.
Implicit conversion is when Python automatically converts the variable to a compatible type. Explicit conversion is when you, the programmer, convert the variable to the target type.