Skip to main content

Python: Implicit Type Conversion

In Python, this method is used to converts automatically one data type to another data type. This process doesn't need any user involvement. 


a = 7
b = 3.0

c = a + b
print('c =',c)

d = a * b
print('d =',d)


<class 'int'>
<class 'float'>
c = 10.0
<class 'float'>
d = 21.0
<class 'float'>

In the above Example,

  • We will look at the data type of all four objects respectively.
  • In the output, we can see the data type of a is an integer while the data type of is a float.
  • Also, we can see the b has a float data type because Python always converts smaller data types to larger data types to avoid the loss of data.
Submitted by devanshi.srivastava on July 1, 2021

Devanshi, is working as a Data Scientist with iVagus. She has expertise in Python, NumPy, Pandas and other data science technologies.


At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.