Changing the data type of a variable in Python from one type to another , as and when required, is called type conversion.

Type conversion is of two types:

  • Explicit Conversion
  • Implicit Conversion

Explicit Conversion

Explicit conversion, also called type casting , happens when data type conversion takes place because the programmer forced it in the program. 

The general form of an explicit data type conversion is: 

(new_data_type) (expression)





Converts x to an integer


Converts x to a floating point number


Converts x to a floating point representation


Converts ASCII value of x to character


Implicit Conversion

Implicit conversion, also known as coercion, happens when data type conversion is done automatically by Python and is not instructed by the programmer.


Example 4 - Teachoo.jpg

Go Ad-free
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 14 years. He provides courses for Maths, Science, Social Science, Physics, Chemistry, Computer Science at Teachoo.