Sitemap
Amanithota

Amanithota

Type Conversion

2 min readNov 18, 2026

Definition:

Type conversion in Python is the process of converting one data type into another data type. It is used to change values from one type, such as integer, float, or string, into another type.

There are two types of type conversion:

  1. Implicit Type Conversion: Python automatically converts one data type into another.
  2. Explicit Type Conversion: The programmer manually converts one data type into another using functions like int( ) , float( ) , and str( ) .

Example 1: Integer to Float

Definition:

Integer to Float conversion means converting a whole number (integer) into a decimal number (float) using the float( ) function in Python.

Explanation:

Here, the variable a stores an integer value 10 . The float( ) function converts it into 10.0 , which is a floating-point number.

Example 2: Float to Integer

Get Amanithota’s stories in your inbox

Join Medium for free to get updates from this writer.

Definition:

Float to Integer conversion means converting a decimal number (float) into a whole number (integer) using the int( ) function in Python.

Explanation:

Here, the variable a stores a decimal value 15.8 . The int( ) function converts it into 15 by removing the decimal part.

Example 3: Integer to String

Definition:

Integer to String conversion means converting a whole number (integer) into text (string) using the str( ) function in Python.

Explanation:

Here, the variable a stores an integer value 100 . The str( ) function converts it into a string value “100” .

Conclusion:

Type conversion in Python is used to convert one data type into another. It helps us change integers into floats, floats into integers, and integers into strings. Python provides functions like int( ) , float( ) ,and str( ) to perform type conversion easily.

--

--